translating "create Semaphore" to Linux
GHUM
haraldarminmassa at gmail.com
Fri Aug 29 08:51:32 EDT 2008
Tim,
> ... why use a Semaphore rather than a Mutex?
as much as I understood the documentation at MSDN
http://msdn.microsoft.com/en-us/library/ms686927(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms686946(VS.85).aspx
a mutex seems to be nothing else than a special case of a semaphore?
That is, a semaphore can be created to allow MAX_SEM_COUNT concurrent
runners, and MUTEX defaults to one and only one ...
The other api-spells are identical, like wait_for_xxxx...; so propably
I stumbled on the working Semaphore Code before, or in some ancient
win32 wrapper createMutex was not documented or something in that
aspect:)
> Or why notsimply use the bound socket as its own mutex? I know
> Windows won't allow you to rebind the same socket to the
> same addr/port in two different processes (unless perhaps
> you play some trickery with the socket options).
My experience was that this is correct for certain values of "allow"
and "trickery". Sometimes the binding seems to get allowed but does
not work. Main reason is that the socket-bind happens somewhere in
medusa or <someotherhttpsserverframeworkiuse>; so to use it as a
semaphore I would have to dig there. I am not totally sure what
trickery on socket is played down there; and I prefer to stay as far
away as possible from that area.
Harald
More information about the Python-list
mailing list