Popular Python recipes tagged "universal_code"http://code.activestate.com/recipes/langs/python/tags/universal_code/2010-02-04T17:36:31-08:00ActiveState Code RecipesTimeout Any Function (Python)
2010-02-04T17:36:31-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577028-timeout-any-function/
<p style="color: grey">
Python
recipe 577028
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/asynchronous/">asynchronous</a>, <a href="/recipes/tags/generic/">generic</a>, <a href="/recipes/tags/process/">process</a>, <a href="/recipes/tags/timeout/">timeout</a>, <a href="/recipes/tags/universal_code/">universal_code</a>).
Revision 6.
</p>
<p>This recipe uses the <code>multiprocessing</code> module to kill functions that have run longer than intended. Unlike other recipes that use threading, this code is designed to actually kill execution that has continued for too long. This implementation does not rely on signals or anything that is OS specific, so it should work on any system on which you might need generic timeouts.</p>