Awake main thread when ANY of the subprocesses finishes
<p>If I launch several of subprocesses in python (using Popen, for instance), how can I place the main thread into sleep mode until at least of them finished? I also need to put some timeout, if none of them finishes after 1min I want to record some log.</p>

<p>If I use <code>p[i].wait(timeout)</code> doesn't work because it will block until p[i] finish, hence if any other subprocess finishes (<code>p[j] - for j!=i</code>) my main thread wouldn't be notified.</p>

<p>What is the proper way to accomplish this?</p>