-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libasynctasks: better handling of exceptions for all threads...
- Loading branch information
1 parent
da3d811
commit 968e19a
Showing
2 changed files
with
21 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import time | ||
|
||
from cpython.exc cimport PyErr_CheckSignals | ||
|
||
|
||
def thread_wait(): | ||
""" | ||
Wait for a short amount of time before executing anymore | ||
code on the thread, this reduces overall idle CPU usage... | ||
""" | ||
|
||
# check for Python error signals so we can except | ||
# errors like KeyboardInterrupt, SystemExit etc... | ||
PyErr_CheckSignals() | ||
|
||
# hault the current thread for a short amount of time, | ||
# so that we use less CPU usage when idling to free up the | ||
# CPU for other running processes... | ||
time.sleep(0.0001) |
This file contains 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