Skip to content

Instantly share code, notes, and snippets.

@neektza
Created April 14, 2017 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neektza/c2744495dfd9d696a574a42864c82338 to your computer and use it in GitHub Desktop.
Save neektza/c2744495dfd9d696a574a42864c82338 to your computer and use it in GitHub Desktop.
module EventMachine
def self.defer op = nil, callback = nil, &blk
unless @threadpool
@threadpool = []
@threadqueue = ::Queue.new
@resultqueue = ::Queue.new
spawn_threadpool
end
@threadqueue << [op||blk,callback]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment