mutex — mutex module
The mutex module provides a mutual-exclusion primitive for protecting
critical sections of code or shared data from concurrent access by an interrupt
service routine and the main thread.
Lock acquisition and release is performed via a context manager (with
statement), which blocks until the mutex is available. A non-blocking
Mutex.test() method is also provided.
class Mutex – mutex object
- class mutex.Mutex
Creates an unlocked mutex object.
- release() None
Unlock the mutex. Raises
mutex.MutexExceptionif the mutex is not currently locked.
Exceptions
- exception mutex.MutexException
Subclass of
OSError. Raised byMutex.releasewhen the mutex is already unlocked.