Semaphore or what should I use?

Ville Vainio ville at spammers.com
Wed Dec 1 09:24:12 EST 2004


>>>>> "Bastian" == Bastian Hammer <webmaster at haustierworld.de> writes:

    Bastian> Now I have to make sure, that both threads are
    Bastian> synchronal, 1 thread edits something and the other is
    Bastian> blocked until the first thread is ready.

    Bastian> Isn´t it a good idea to do this with a semaphore?

Semaphore will do, but this is a classical use case for
threading.Lock.

There should be lots of stuff regarding locks (or more googleably,
"mutexes") on the net.

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list