How to set timeout to threads?
<p>I'm using <code>threading.Thread</code> to multi-thread my code.
I want to catch <code>Timeout exception</code> if at least 1 of the Threads did not finish their work in X seconds.
I found some answers here, describing how to deal with that, but most of them were UNIX compatible, whereas I'm using Windows platform.</p>

<p>Code for example:</p>

<pre><code>from threading import Thread
from time import sleep

def never_stop():
    while 1 &gt; 0:
        print 'a'
        sleep(5)
        print 'b'
    return

t1 = Thread(target=never_stop)
t1.start()
t2 = Thread(target=never_stop)
t2.start()
t3 = Thread(target=never_stop)
t3.start()
t1.join(2)
t2.join(2)
t3.join(2)
</code></pre>

<p>I tried to set timeout in the <code>join</code> method but it was useless..</p>

<p>Any ideas?</p>