Threading questions
F. GEIGER
f.geiger at vol.at
Sat May 28 12:25:15 EDT 2005
Just an idea: You could have n data collector threads, that all put their
results into a queue connected to 1 db thread, that stores the results into
the db.
Cheers
Franz GEIGER
"Antal Rutz" <arutz at mimoza.pantel.net> schrieb im Newsbeitrag
news:mailman.213.1117287469.18027.python-list at python.org...
> Hi, All!
>
> I'm new to threading. I have some design questions:
> Task: I collect data and store them in an RDBMS (mysql or pgsql)
>
> The question is how to do that with threading?
> The data-collecting piece of the code runs in a thread.
>
> 1. Open the db, and each thread writes the result immediately.
> (Sub-question: which is better: cursor object passed to the thread
> or stored in a global var.)
> 2. Threads return data, which is written to DB after that.
> 3. Threads write to global variable, after 'join()' data is written.
> (Can be used global (write-only) variables with threads at all?)
> 4. ?...
>
> I think variable locking isn't an issue here because they are write-only.
>
> Maybe I have fundamentaly misunderstood something...
>
> Thanks
>
> --
>
>
> --arutz
>
More information about the Python-list
mailing list