MainThread blocks all others
Bryan Olson
fakeaddress at nowhere.org
Tue Aug 9 19:18:35 EDT 2005
I wrote:
> Make self.counter a semaphore. Untested code:
A little clean-up. Still untested:
import threading
class class1:
def __init__(self):
self.counter = threading.semaphore(0)
result = self.doSomeJob()
def increaseCounter(self):
self.counter.release()
def doSomeJob(self):
# Busy-waiting sucks.
# while counter != 1:
# pass
self.counter.acquire()
# ... continue...
--
--Bryan
More information about the Python-list
mailing list