New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
threading.Condition.wait() return value indicates timeout #41798
Comments
A condition variable returns in two cases: it was http://boost.org/doc/html/condition.html This patch adds this capability to the Python (An example is using a condition variable as a sentinel |
Logged In: YES This looks like a good idea to me. It will help to clean up while self._empty():
remaining = endtime - _time()
if remaining <= 0.0:
raise Empty
self.not_empty.wait(remaining) Here, self.not_empty is an object of the class I'll write a message to python-dev in support of this patch |
Logged In: YES Sorry, I think this is a poor idea, and mdehoon's suggestion The check should always be done when .wait() doesn't time Note too that .wait()'s caller holds the associated mutex I don't understand this:
To the extent that I might understand it, it sounds like a |
Logged In: YES hi tim my use of a condition variable is exemplified in this def background_thread( func, args, condvar, callbacks, delay ):
"""
A background thread that computes something periodically.
or pause.
condvar.acquire()
if condvar.pause:
# this branch is used to pause the thread.
condvar.wait()
else:
condvar.wait(delay)
if condvar.quit:
done = 1
condvar.release() instead of using the "quit" data member, i could instead use AFAIK this is a common usage pattern. i've seen it in a few not that it's really an argument, but i did see 3 i think Event.wait() should also return the signaled/timeout also, you are correct about mdehoon's case, after returning |
Another bug day task. |
I have a question: Timeout means "something has messed up, can not continue." |
I don't think an exception is the proper thing to use here. Having the
|
Since Tim Peters is the absolute authority on concurrency in Python, |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: