jmar777/suspend — pull request #11 by helmus (2013-11-02 20:16:23+00:00)
Title: sync detect

continuation of #10

I understand the need for the transparent resolution. Although i do think that sync callbacks are an edge case and that handling them explicitly seems appropriate, even more so because of the increased code documentation then the neglectable performance gain.

Anyway, i followed up on your advice and implemented some setImmediate magic in order to detect if the call is synchronous.
If the callback is asynchronous then ```resume``` is called immediately, if it is synchronous the arguments are stored on the instance and ```resume``` will be called from the setImmediate function call that was already started to check if the call is synchronous.

I have no idea if this will cause anything to be faster than the current implementation but i do feel this might resolve async handlers more naturally.