executing multiple functions in background simultaneously
Jean-Paul Calderone
exarkun at divmod.com
Wed Jan 14 20:20:27 EST 2009
On Wed, 14 Jan 2009 17:11:44 -0800, Catherine Moroney <catherine.m.moroney at jpl.nasa.gov> wrote:
> [snip]
>>
>>The easy thing is to use a Queue object. The background thread uses
>>.put() to place a computed result on the QUeue and the caller uses
>>.get() to read from the queue. There's an assortment of other ways too.
>>
>>Cheers,
>
>Thank you for this hint. This goes a long way to solving
>my problem.
>
>One question - is there any way to name the objects that get
>put on a queue? For my application, it's important to know
>which thread put a particular item on the queue.
There's lots and lots of ways. The simplest might be to put two-tuples
of the thread identifier and some other object. eg
queue.put((threadID, obj))
Perhaps you can accomplish your goal that way, or perhaps a minor
variation would be more suitable.
Jean-Paul
More information about the Python-list
mailing list