On Jan 14, 2009, at 5:20 PM, Jean-Paul Calderone wrote:

On Wed, 14 Jan 2009 17:11:44 -0800, Catherine Moroney <catherine.m.moro...@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.

I just came to that conclusion myself and a short test shows
that things are working.

Thanks to all who contributed to this discussion.  Even though I'm
by no means an expert, at least I can work with threads and queues
now!  I love this language ...


Jean-Paul

Catherine
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to