event_machine: join reactor_thread if it is already running
authorMark J. Titorenko <mark.titorenko@alces-software.com>
Fri, 11 Jan 2013 11:57:12 +0000 (11:57 +0000)
committerEric Wong <normalperson@yhbt.net>
Fri, 11 Jan 2013 19:59:36 +0000 (19:59 +0000)
commita12d2e64e04b5098f31e63a72ea8330b6c8f3a19
treead10e340cf605b7d244eb5d56aa9e8796bc07310
parent28eaf3e766f5dddc6ca073a155b8005afdaecfba
event_machine: join reactor_thread if it is already running

...rather than falling through worker_loop

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.

[ew: commit message formatting]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
lib/rainbows/event_machine.rb