<div><h3id="semaphoreeventbarrier">Semaphore, Event, Barrier</h3><pre><codeclass="python language-python hljs"><Semaphore> = Semaphore(value=<spanclass="hljs-number">1</span>) <spanclass="hljs-comment"># Lock that can be acquired 'value' times.</span>
<Event> = Event() <spanclass="hljs-comment"># Method wait() blocks until set() is called.</span>
<Barrier> = Barrier(n_times) <spanclass="hljs-comment"># Method wait() blocks until it's called n_times.</span>
<Barrier> = Barrier(n_times) <spanclass="hljs-comment"># Method wait() blocks until it's called 'n_times'.</span>
</code></pre></div>
<div><h3id="threadpoolexecutor">Thread Pool Executor</h3><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> concurrent.futures <spanclass="hljs-keyword">import</span> ThreadPoolExecutor