Events

This lesson talks about Events, which is a lesser known utility class within the threading module.

We'll cover the following...

Events

An event object is one of the simplest primitives available for synchronization. Internally, it has a boolean flag that can be set or unset using the methods set() and clear(). Additionally, a thread can check if the flag is set to true by invoking the is_set() method.

The event object exposes a wait() method that threads can invoke to wait for the internal boolean flag to become true. If the flag is already true, the thread returns immediately. If there are multiple threads waiting on the event object and an active thread sets the flag then all the waiting threads are unblocked.

Event is a convenience class and a ...