Possible Duplicate:
Timeout on a Python function call
I want to implement that when the function took more than 90 seconds to complete it should return immediately when timeout. Is there any way to achieve that?
def abc(string):
import re
if re.match('some_pattern', string):
return True
else:
return False
abc('some string to match')
Edited
Please download this test file. I have created a thread class and raise an exception within thread if timeout error occur. But thread is still alive because it prints i am still alive :)
even after exception. Why an exception does not force the thread to stop??