Methods and classes for creating platform threads.


_class Lock(object)

Represents an atomic mutex.

Lock objects allow for exclusive access to a resource and can be used in a with block.

_let x = Lock()


Initialize a system mutex.


Acquire the lock.


Release the lock.

_class Thread(object)

Base class for building threaded execution contexts.

The Thread class should be subclassed and the subclass should implement a run method.


Query the status of the thread.


Join the thread. Does not return until the thread finishes.


Start the thread. A thread may only be started once.

_property Thread.tid

The platform-specific thread identifier, if available. Usually an integer.



Obtain a reference to the current thread.

Returns the Thread object associated with the calling thread, if one exists.


_class ThreadError(OSError)

Raised in various situations when an action on a thread is invalid.