igrigorik/em-synchrony — pull request #173 by dirkbolte (2013-11-05 07:16:30+00:00)
Title: Adding hook to override Kernel.sleep behavior

I recently ran into an issue where I used Resque::Plugins::Workers::Lock in an application with EM::Synchrony. That plugin is not fiber aware and calls Kernel.sleep in certain situations. Although I was able to fix this by monkey-patching that gem, I wondered how I can address this issue in a generic way or at least have some kind of information that I ran into a similar issue.

For that reason I created a hook in EM::Synchrony to specify what to do when sleep is called. Thereby I can specify that something is locked or even redirect the sleep to the EM::Synchrony version of it.

I wonder whether this kind of functionality would be helpful.