Created
April 21, 2016 11:10
-
-
Save dmitryhd/2b16e1f2afaf6b79a40f984fcc0feca4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import stopit | |
| with stopit.ThreadingTimeout(3) as to_ctx_mgr: | |
| assert to_ctx_mgr.state == to_ctx_mgr.EXECUTING | |
| # Something potentially very long but which | |
| sleep(2) | |
| print('done') | |
| print(bool(to_ctx_mgr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment