17 Oct '13, 4pm

@hiphoox Should have dig deeper the EM docs: Thanks!

EventMachine.defer is used for integrating blocking operations into EventMachine's control flow. The action of defer is to take the block specified in the first parameter (the "operation") and schedule it for asynchronous execution on an internal thread pool maintained by EventMachine. When the operation completes, it will pass the result computed by the block (if any) back to the EventMachine reactor. Then, EventMachine calls the block specified in the second parameter to defer (the "callback"), as part of its normal event handling loop. The result computed by the operation block is passed as a parameter to the callback. You may omit the callback parameter if you don't need to execute any code after the operation completes. Caveats Note carefully that the code in your deferred operation will be executed on a separate thread from the main EventMachine processing and all ot...

Full article: http://eventmachine.rubyforge.org/EventMachine.html#add_p...

Tweets

@smoozoid

rubyonrails.org 26 Oct '13, 3pm

If you're just getting started or want to learn about Rails in general, check the Rails Guides . APIs Browse all framework...