executing multiple functions in background simultaneously

Steve Holden steve at holdenweb.com
Thu Jan 15 00:58:11 EST 2009


Jean-Paul Calderone wrote:
> 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.
> 
Catherine:

Did you attend one of my classes at JPL?  Feel free to rope me in to
discussions like this if so. (Or even if not: NASA are a good customer).

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list