Skip to content

Instantly share code, notes, and snippets.

@axelabs
Created March 19, 2015 15:30
Show Gist options
  • Save axelabs/51ebce97ddbd8f9ab475 to your computer and use it in GitHub Desktop.
Save axelabs/51ebce97ddbd8f9ab475 to your computer and use it in GitHub Desktop.
Unblocking EventMachine's deferred callbacks [output]
[2015-03-19 10:26:00 -0500] I'm a blocking worker, I'll be done in 2 secs
[2015-03-19 10:26:01 -0500] .
[2015-03-19 10:26:02 -0500] .
[2015-03-19 10:26:02 -0500] worker done!
[2015-03-19 10:26:02 -0500] I'm a blocking callback, I'll be done in 4 secs
[2015-03-19 10:26:06 -0500] callback done!
[2015-03-19 10:26:06 -0500] .
[2015-03-19 10:26:07 -0500] I'm a blocking worker, I'll be done in 2 secs
[2015-03-19 10:26:07 -0500] .
[2015-03-19 10:26:08 -0500] .
[2015-03-19 10:26:09 -0500] worker done!
[2015-03-19 10:26:09 -0500] I'm a non-blocking callback, I'll be done in 4 secs
[2015-03-19 10:26:09 -0500] .
[2015-03-19 10:26:10 -0500] .
[2015-03-19 10:26:11 -0500] .
[2015-03-19 10:26:12 -0500] .
[2015-03-19 10:26:13 -0500] callback done!
[2015-03-19 10:26:13 -0500] .
[2015-03-19 10:26:14 -0500] .
[2015-03-19 10:26:15 -0500] Bye!
@axelabs
Copy link
Author

axelabs commented Mar 19, 2015

This is the output for the following ruby code: http://goo.gl/8kbc6y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment