semaphores and Rlocks
Jive Dadson
jsdfaljksdfajil at dfassdfasdfa.invalid
Sun Dec 22 02:46:37 EST 2002
More information about the Python-list mailing list
Sun Dec 22 02:46:37 EST 2002
- Previous message (by thread): semaphores and Rlocks
- Next message (by thread): semaphores and Rlocks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've implemented a Condition class as described in the previous post. It uses a global wakeup service thread for timeouts. That moves the latency that results from time.sleeping from the case where there is a notification to the case where there is a timeout. It is similar in semantics to the class Condition in module threading, with these differences: 1. It works with any thread created by thread.start_new_thread(). It does not have or require a class Thread. In fact it does not use module threading at all. It is my impression that you have to register your thread in a class Thread object to use threading.Condition. Correct me if I'm wrong. 2. If a wait() times out, it returns the timeout interval rather than None. Otherwise the caller has no really good way of finding out. I doubt that would break anyone's code. If you are interested, let me know. See munged email address below sig. Naturally, the code is not ready for prime time. In its present form it is not a drop-in replacement for threading.Condition. For one thing, I have not implemented any entries other than acquire, wait, notify, notifyAll, and release. Some Python guru would need to polish it up, looking for things like namespace polution and, well, not being a Python guru, I don't know what else. Jive jdadson (at) ix (dot) netcom (dot) com
- Previous message (by thread): semaphores and Rlocks
- Next message (by thread): semaphores and Rlocks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list