threading

Methods and classes for creating platform threads.

Classes

_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()

Lock.__init__()

Initialize a system mutex.

_Lock.__enter__()

Acquire the lock.

_Lock.__exit__()

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.

_Thread.is_alive()

Query the status of the thread.

_Thread.join()

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

_Thread.start()

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

_property Thread.tid

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

Functions

_current_thread()

Obtain a reference to the current thread.

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

Exceptions

_class ThreadError(OSError)

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