mt.threading
Additional utitlities dealing with threading.
Instead of:
import threading
You do:
from mt import threading
It will import the threading package plus the additional stuff implemented here.
Please see Python package threading for more details.
Classes
ReadWriteLock
: A lock object that allows many simultaneous “read locks”, butReadRWLock
: Undocumented.WriteRWLock
: Undocumented.LockedIterator
: An wrapper that locks the input iterator to make sure it is thread-safe.
- class mt.threading.ReadWriteLock(withPromotion=False)
A lock object that allows many simultaneous “read locks”, but only one “write lock.”
Inheritance
digraph inheritance0914f144e4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ReadWriteLock" [URL="#mt.threading.ReadWriteLock",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A lock object that allows many simultaneous \"read locks\", but"]; }- acquire_read()
Acquire a read lock. Blocks only if a thread has acquired the write lock.
- acquire_write()
Acquire a write lock. Blocks until there are no acquired read or write locks.
- is_free()
Returns whether there is no reader and no writer.
- release_read()
Release a read lock.
- release_write()
Release a write lock.
- class mt.threading.ReadRWLock(rwLock)
Inheritance
digraph inheritance6e19efbdbe { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ReadRWLock" [URL="#mt.threading.ReadRWLock",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class mt.threading.WriteRWLock(rwLock)
Inheritance
digraph inheritance4212cf8bdd { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "WriteRWLock" [URL="#mt.threading.WriteRWLock",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class mt.threading.LockedIterator(it)
An wrapper that locks the input iterator to make sure it is thread-safe.
Inheritance
digraph inheritanceba7d414040 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "LockedIterator" [URL="#mt.threading.LockedIterator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An wrapper that locks the input iterator to make sure it is thread-safe."]; }