Bases: winsys.core._WinSysObject
A Mutex is a kernel object which can only be held by one thread or process at a time. Its usual application is to protect shared data structures or to prevent more than one instance of an application from running simultaneously. Mutexes can be named or anonymous. Anonymous mutexes can be used between processes by passing their handle from one process to the other on the command line.
This is very similar to a Python threading.Lock object. (In fact the Python objects are implemented as Semaphores on Windows, presumably for re-entrancy). For this reason, the acquire() and release() names have been used for methods.
The mutex is its own context manager, so a typical usage would be:
from winsys import ipc
with ipc.mutex("ONLYONCE"):
# do stuff