MainThread blocks all others

Nodir Gulyamov gelios at rbcmail.ru
Wed Aug 10 09:42:34 EDT 2005


Hi,
    Thanks your reply again. Please find my comments below.

> Your code did not, and could not, use the value of counter for
> anything but busy-waiting. You had:
>
>         while counter != 1:
>             pass
>         # ... continue...
>
> If you replace this with the semaphore, you can just assume a
> counter value of one.
>
I replaced it by semaphore, but how should i check is semaphore changed or 
not?
When I call release() method of semaphore, internal counter is increased and 
value will be equal to number of release() calls minus number of acquire() 
calls. Am I right?
Ok, in this case what condition should I check in while statement?

 





More information about the Python-list mailing list