cotag / libuv

Ruby bindings for libuv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to exec stop callback?

Ice-Storm opened this issue · comments

commented

I'm confused that how to exec stop reactor callback?
I see reactor.rb stop_cb function, but it's protected and not have callback params.
thx !!
And how to restart reactor?

stop_cb is protected as stop is thread safe and stop_cb is not - called internally by Libuv to perform the stopping of the reactor.

The reactor will stop by itself when there is no more IO to process. i.e. once all connections are closed, timers fired etc then the reactor will stop.

Calling stop, stops the reactor when there is still pending IO. This can be desirable - especially when you want to exit and maybe don't care to close everything manually.

Once a reactor is stopped, you can just call run on it again to start it. Any pending IO that existed when you called stop will resume too.

commented

thank you very much !!

commented

Looks like this was all solved. Closing.