MainThread blocks all others
gelios at rbcmail.ru
Wed Aug 10 10:14:36 CEST 2005
Thanks for your reply.
I tried to test your solution, but it doesn't work, hence
threading.Semaphore object hasn't method to get value of semaphore.
I looked to source code of semaphore.py and find out that value is private
"Bryan Olson" <fakeaddress at nowhere.org> wrote in message
news:fRaKe.3656$zr1.2646 at newssvr13.news.prodigy.com...
> > 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):
> def doSomeJob(self):
> # Busy-waiting sucks.
> # while counter != 1:
> # pass
> # ... continue...
More information about the Python-list