-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How about adding async interfaces to some blocking functions? #878
Comments
|
I know what you say. |
from the doc: When interval is > 0.0 compares system CPU times elapsed before and after the interval (blocking). When interval is 0.0 or None compares system CPU times elapsed since last call or module import, returning immediately (non-blocking). |
There is no need to change cpu_percent() so that it works with the new On Wed, Aug 31, 2016 at 3:06 PM, Taeguk Kwon notifications@github.com
Giampaolo - http://grodola.blogspot.com |
async def cpu_percent(interval = None, *args, **kwargs):
if interval is not None and interval > 0.0:
psutil.cpu_percent(*args, **kwargs)
await asyncio.sleep(interval)
return psutil.cpu_percent(*args, **kwargs) Okay, I got it. I can do my hope through the above codes. |
For example, there is a function called cpu_percent().
Now, this function is just blocking with a interval parameter.
A user must use multi-thread to utilize cpu during the interval.
I want to use a asyncio feature for it.
How about adding async interfaces to some blocking functions?
The text was updated successfully, but these errors were encountered: