eventmachine/eventmachine — pull request #316 by paddor (2012-04-19 16:16:46+00:00)
Title: Add EventMachine.defers_finished?

This method can be useful when deciding when to stop EventMachine. For example, after thousands of connections established by EventMachine and each connection could defer some actions, this method reliably tells whether it's safe to stop EventMachine or not. It could be used repeatedly after the last connection has unbound.

Otherwise it's not easy to decide when it's safe to stop EventMachine, even after the last connection has unbound. And it's not safe to stop EventMachine right away because it'll #kill the running threads in the threadpool.