Popular recipes by dustin lee http://code.activestate.com/recipes/users/2771318/popular/2006-02-09T14:30:29-08:00ActiveState Code RecipesTimeout function using threading (Python)
2006-02-09T14:30:29-08:00dustin leehttp://code.activestate.com/recipes/users/2771318/http://code.activestate.com/recipes/473878-timeout-function-using-threading/
<p style="color: grey">
Python
recipe 473878
by <a href="/recipes/users/2771318/">dustin lee</a>
(<a href="/recipes/tags/threads/">threads</a>).
</p>
<p>Using signals to timeout a function such as in:
<a href="http://www.pycs.net/users/0000231/weblog/2004/10/" rel="nofollow">http://www.pycs.net/users/0000231/weblog/2004/10/</a>
<a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871" rel="nofollow">http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871</a>
won't work if the function you are calling overrides the alarm. Using threads gives you away around this.</p>