<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 by 'value' threads.</span>
<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 by 'value' threads at once.</span>
<Event> = Event() <spanclass="hljs-comment"># Method wait() blocks until set() is called.</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>