Question about mutexes

Jan Danielsson jan.danielsson at gmail.com
Wed Jun 1 11:59:27 EDT 2005


In OS/2 C, I would do this:

main()
{
...
DosCreateMutexSem(NULL, &hmtx, 0UL, FALSE);
...
}

thread()
{
...
DosRequestMutexSem(hmtx);

Locked!

DosReleaseMutexSem(hmtx);
...
}

How would I go about doing that in Python?

I figured this part out:

lockobj = mutex()

lockobj.lock(foo, "bar")

Locked!

lockobj.unlock()


Now, what (and more importantly: WHY?!) - is foo and "bar" for?

   I have written a dummyfunction for foo which does nothing when
called, but I fail to see the point of its existence. Could someone
provide an example when this would be useful?



More information about the Python-list mailing list