-
Notifications
You must be signed in to change notification settings - Fork 105
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
pending tasks in loop #24
Comments
active_handles is a libuv internal thing which shouldn't be in pyuv, so I'll probably remove it for 0.9.0, so don't rely on it. loop.run() will return when no handle is holding a reference to it. Handles hold a reference to the loop when they are active, but you can unref() a handle after you start it if you don't want it to keep the loop alive. I guess that you are dealing with the "how do I stop the loop" problem then. You can use loop.walk and close all handles, for example:
Hope this helps. |
mm I have a heartbeat running in background to make sure the loop event handler is part of the tasks. Not sure in this case how I can do.If I unref it most probably the loop will close if no other handle is running I guess |
Exactly. If you don't want the heartbeat to keep the loop alive unref() it after you start it. I usually do this for Signal handles, for example. |
OK thanks. This is finally what I do in flower: The loop task will run until no pending events exists. A timer make sure that the loop let other tasks running. |
ok figured it. Closing the issue. Thanks for your answer. |
It seems that active_handlers only return the number of active handlers at a a time but not return the real number of pending tasks. For example I can have one pending ticker not showing as active; should I reference all the loop tasks unsing ref() ?
The text was updated successfully, but these errors were encountered: