Named semaphores in Python?

后端 未结 2 821
后悔当初
后悔当初 2021-01-04 08:44

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

2条回答
  •  温柔的废话
    2021-01-04 09:09

    I suggest a third party extension like these, ideally the posix_ipc one -- see in particular the sempahore section in the docs.

    These modules are mostly about exposing the "system V IPC" (including semaphores) in a unixy way, but at least one of them (posix_ipc specifically) is claimed to work with Cygwin on Windows (I haven't verified that claim). There are some documented limitations on FreeBSD 7.2 and Mac OSX 10.5, so take care if those platforms are important to you.

提交回复
热议问题