Semaphore or what should I use?

Ville Vainio ville at
Thu Dec 2 14:56:49 CET 2004

>>>>> "Sergei" == Sergei Organov <osv at> writes:

    Sergei> My answer to OP's question is: use either lock (mutex) or
    Sergei> semaphore.  I'd probably use semaphore as mutexes are
    Sergei> usually optimized for the case when contention probability
    Sergei> is low (i.e., they usually shouldn't be locked for a long
    Sergei> time).

Both Mutexes and Semaphores put the thread to sleep, so I don't think
there will be a big difference.

The OP might also want to check out read/write lock. The first thing
google finds is

Ville Vainio

More information about the Python-list mailing list