TimeoutQueue.py

Ype Kingma ykingma at accessforall.nl
Sun Jun 23 15:43:59 EDT 2002


Chris, Tim,

Tim Peters wrote:
> 
> [Chris Liechti]
> > Anyone ever needed a Queue with timeout?

Yes, and I found a solution for jython, see below.
 
> Yes.  I encourage you to submit a patch to SourceForge, adding optional
> timeout arguments to the std Queue module (include the requisite doc changes
> and test suite changes too, and I'll secretly ram it in <wink>).  Queue was
> written long before threading.py, and, as you noticed, the blocking
> operations in threading.py generally do support optional timeouts.  They're
> a Good Idea for all blocking operations.

For jython users: a queue with timeout on get() and put() operations
was done by Doug Lea in his util.concurrent java package. See:
http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/828840
for a python interface to this package.

Btw. I would expect Chris' patch to work in jython, too.

Chris, did you add a timeout to the put() method as well?

Regards,
Ype


-- 
email at xs4all.nl



More information about the Python-list mailing list