[LAD] [somewhat OT] semaphores in python

Tim Goetze tim at quitte.de
Tue Aug 26 20:12:54 UTC 2008


[Fons Adriaensen]
>Does anyone know of a counting semaphare class/module
>in Python ? Given the lock provided by the built-in
>thread module it seems impossible to implement this
>(it does support multiple waiters which I don't need,
>but definitely is not counting). This also means that
>whatever is defined in the threading module can't be
>what I want.

Perhaps I don't quite understand your needs, but the standard 
Semaphore object in the threading module claims to support counting:

http://docs.python.org/lib/semaphore-objects.html

I haven't used it myself yet but the Python docs have never promised 
me anything that didn't work as described (yay!).  I guess I must be 
missing something.

Cheers, Tim



More information about the Linux-audio-dev mailing list