Named semaphores in Python?

Posted by Boaz on Stack Overflow See other posts from Stack Overflow or by Boaz
Published on 2010-05-09T18:45:26Z Indexed on 2010/05/09 18:48 UTC
Read the original article Hit count: 327

Hi,

I have a script in python which uses a resource which can not be used by more than a certain amount of concurrent scripts running.

Classically, this would be solved by a named semaphores but I can not find those in the documentation of the multiprocessing module or threading .

Am I missing something or are named semaphores not implemented / exposed by Python? and more importantly, if the answer is no, what is the best way to emulate one?

Thanks, Boaz

PS. For reasons which are not so relevant to this question, I can not aggregate the task to a continuously running process/daemon or work with spawned processed - both of which, it seems, would have worked with the python API.

© Stack Overflow or respective owner

Related posts about python

Related posts about multithreading