I had future investigation and as I understand in POSIX compliant threads, 
getting value of semaphore should be exist.
As the matter of fact Python threads is not fully POSIX compliant. Pitty!
Contining looking for another solution.

"Nodir Gulyamov" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi Bryan,
>    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 
> variable.
>
> Best regards,
> /Gelios
>
> "Bryan Olson" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>>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
>
> 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to