threading.Condition.wait()

wait(timeout=None) Wait until notified or until a timeout occurs. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method releases the underlying lock, and then blocks until it is awakened by a notify() or notify_all() call for the same condition variable in another thread, or until the optional timeout occurs. Once awakened or timed out, it re-acquires the lock and returns. When the timeout argument is present and not None, it should

threading.Condition.wait_for()

wait_for(predicate, timeout=None) Wait until a condition evaluates to True. predicate should be a callable which result will be interpreted as a boolean value. A timeout may be provided giving the maximum time to wait. This utility method may call wait() repeatedly until the predicate is satisfied, or until a timeout occurs. The return value is the last return value of the predicate and will evaluate to False if the method timed out. Ignoring the timeout feature, calling this method is rough

threading.Condition.notify_all()

notify_all() Wake up all threads waiting on this condition. This method acts like notify(), but wakes up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised.

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.

threading.Condition.release()

release() Release the underlying lock. This method calls the corresponding method on the underlying lock; there is no return value.

threading.Condition

class threading.Condition(lock=None) This class implements condition variable objects. A condition variable allows one or more threads to wait until they are notified by another thread. If the lock argument is given and not None, it must be a Lock or RLock object, and it is used as the underlying lock. Otherwise, a new RLock object is created and used as the underlying lock. Changed in version 3.3: changed from a factory function to a class. acquire(*args) Acquire the underlying lock. T

threading.Condition.acquire()

acquire(*args) Acquire the underlying lock. This method calls the corresponding method on the underlying lock; the return value is whatever that method returns.

threading.Barrier.reset()

reset() Return the barrier to the default, empty state. Any threads waiting on it will receive the BrokenBarrierError exception. Note that using this function may can require some external synchronization if there are other threads whose state is unknown. If a barrier is broken it may be better to just leave it and create a new one.

threading.Barrier.wait()

wait(timeout=None) Pass the barrier. When all the threads party to the barrier have called this function, they are all released simultaneously. If a timeout is provided, it is used in preference to any that was supplied to the class constructor. The return value is an integer in the range 0 to parties – 1, different for each thread. This can be used to select a thread to do some special housekeeping, e.g.: i = barrier.wait() if i == 0: # Only one thread needs to print this print("pas

threading.BrokenBarrierError

exception threading.BrokenBarrierError This exception, a subclass of RuntimeError, is raised when the Barrier object is reset or broken.