Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] event_machine: join reactor_thread if it is already running rather than falling through worker_loop
@ 2013-01-11 11:57 Mark J. Titorenko
       [not found] ` <F24725C0-EE29-4AA0-85C3-8E0A756EB9F9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Mark J. Titorenko @ 2013-01-11 11:57 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org

Prior to the application of this patch, if an EventMachine reactor_thread has already been started elsewhere before the worker_loop is entered, the worker_loop exits as a second call to EM.run does not block the current thread.

This patch causes the worker_loop thread to join the reactor_thread if it is running.

Cheers,

Mark.

---
 lib/rainbows/event_machine.rb |    1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index 3ecdb4f..b143b39 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -99,6 +99,7 @@ module Rainbows::EventMachine
         end
       end
     }
+    EM.reactor_thread.join if EM.reactor_running?
   end
 end
 # :enddoc:
-- 
1.7.9.6 (Apple Git-31.1)

_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-11 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-11 11:57 [PATCH] event_machine: join reactor_thread if it is already running rather than falling through worker_loop Mark J. Titorenko
     [not found] ` <F24725C0-EE29-4AA0-85C3-8E0A756EB9F9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-11 20:18   ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).