Movatterモバイル変換


[0]ホーム

URL:


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:6.10.1 Scheduler ObjectsUp:6. Generic Operating SystemNext:6.11.1 Mutex Objects

6.11mutex -- Mutual exclusion support

Themutex module defines a class that allows mutual-exclusionvia acquiring and releasing locks. It does not require (or imply)threading or multi-tasking, though it could be useful forthose purposes.

Themutex module defines the following class:

classmutex()
Create a new (unlocked) mutex.

A mutex has two pieces of state -- a ``locked'' bit and a queue.When the mutex is not locked, the queue is empty.Otherwise, the queue contains zero or more(function,argument) pairsrepresenting functions (or methods) waiting to acquire the lock.When the mutex is unlocked while the queue is not empty,the first queue entry is removed and itsfunction(argument) pair called,implying it now has the lock.

Of course, no multi-threading is implied - hence the funny interfaceforlock(), where a function is called once the lock isacquired.


Subsections


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:6.10.1 Scheduler ObjectsUp:6. Generic Operating SystemNext:6.11.1 Mutex Objects
Release 2.2.3, documentation updated on 30 May 2003.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2026 Movatter.jp