Waiting on multiple Event objects in Python 3

Pas­si­ve wai­ting is a way of suspen­ding pro­grams execu­ti­on without con­su­ming any CPU (in con­trast with acti­ve wai­ting whe­re a pro­gram is busy doing nothing). In Python, you can use cer­ta­in clas­ses from the threa­ding modu­le (such as Con­di­ti­on and Event). Let’s take for exam­ple the Event class. It is good for wai­ting for an event. But what if you need to wait for many events? You might say „Why not to make a list of mul­tiple Event objects and wait for all of them?” Well… that is not going to work:

(more…)