This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: opt. timeouts for Queue.put() and .get()
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: cliechti, loewis
Priority: normal Keywords: patch

Created on 2002-06-23 00:37 by cliechti, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
queue.patch cliechti, 2002-06-23 00:37 two patches for Queue.py and test/test_queue.py merged in one file
libqueue.diff cliechti, 2002-10-13 19:17 patch for the docs (libqueue.tex)
Messages (4)
msg40390 - (view) Author: Chris Liechti (cliechti) Date: 2002-06-23 00:37
Sometimes one wants a Queue that doesn't block forever on a get() 
or put(). Both should be able to return after a certain time, acting like 
they were called non-blocking and failed. i.e get() raises the Empty 
exception when it times out, put() raises Full.

This patch 
adds optional timeout arguments to these methods.
The old 
'block' arg is left and behaves 100% like in the old days (backwards 
compatibility). The new feature appears only when 'block' is true 
and 'timeout' is a positive number.

The new code is basicaly 
a merge between the original Queue.py's put() and get() and 
threading.py's 
_Event.wait() --- code that's proven to work, 
nothing realy new here.

I also added some simple tests to 
the test_queue.py script for the new feature.
msg40391 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-13 13:01
Logged In: YES 
user_id=21627

Can you please provide documentation changes (for
libqueue.tex) as well?
msg40392 - (view) Author: Chris Liechti (cliechti) Date: 2002-10-13 19:17
Logged In: YES 
user_id=403744

Here's the patch for the docs. I also updated the references to 0/1 to 
False/True in the other method descriptions.
msg40393 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-15 15:12
Logged In: YES 
user_id=21627

Thanks for the patch. Applied as

Queue.py 1.17;
test_queue.py 1.3;
libqueue.tex 1.13;
NEWS 1.501;
History
Date User Action Args
2022-04-10 16:05:26adminsetgithub: 36787
2002-06-23 00:37:32cliechticreate