threading.Lock

class threading.Lock The class implementing primitive lock objects. Once a thread has acquired a lock, subsequent attempts to acquire it block, until it is released; any thread may release it. Changed in version 3.3: Changed from a factory function to a class. acquire(blocking=True, timeout=-1) Acquire a lock, blocking or non-blocking. When invoked with the blocking argument set to True (the default), block until the lock is unlocked, then set it to locked and return True. When invoked

threading.local

class threading.local A class that represents thread-local data. For more details and extensive examples, see the documentation string of the _threading_local module.

threading.get_ident()

threading.get_ident() Return the ‘thread identifier’ of the current thread. This is a nonzero integer. Its value has no direct meaning; it is intended as a magic cookie to be used e.g. to index a dictionary of thread-specific data. Thread identifiers may be recycled when a thread exits and another thread is created. New in version 3.3.

threading.Event.wait()

wait(timeout=None) Block until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls set() to set the flag to true, or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). This method returns true if and only if the internal flag has been set to true, either before the wait c

threading.Event.set()

set() Set the internal flag to true. All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all.

threading.Event.is_set()

is_set() Return true if and only if the internal flag is true.

threading.Event.clear()

clear() Reset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again.

threading.Event

class threading.Event Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. Changed in version 3.3: changed from a factory function to a class. is_set() Return true if and only if the internal flag is true. set() Set the internal flag to true. All threads waiting for it to become true are awakened. Threads that

threading.enumerate()

threading.enumerate() Return a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started.

threading.current_thread()

threading.current_thread() Return the current Thread object, corresponding to the caller’s thread of control. If the caller’s thread of control was not created through the threading module, a dummy thread object with limited functionality is returned.