From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=0.0 required=3.0 tests=MSGID_FROM_MTA_HEADER, TVD_RCVD_IP shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: "Mark J. Titorenko" Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: [PATCH] event_machine: join reactor_thread if it is already running rather than falling through worker_loop Date: Fri, 11 Jan 2013 11:57:12 +0000 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1357905800 12526 80.91.229.3 (11 Jan 2013 12:03:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2013 12:03:20 +0000 (UTC) To: "rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org" Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Fri Jan 11 13:03:33 2013 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:content-type:content-transfer-encoding:subject :message-id:date:to:mime-version:x-mailer:x-gm-message-state; bh=pi7y6SQT56S08aBKpx1iKndzift2A0vaPSHtn/BGBDw=; b=NHwAzynVNxdpXIVQSqz+3C854334LiYkXCyMTQYKl4EaNgsoBA207GUXcamCv0pBNx 52I24I+XEGnzD4dcwB8PtjIf3lykmSRfH+Gm4ATQBQDd5NejZVxfdiv/TSbip5iFd/bU NeSNhZhy2MedlWFsZYEqS/06EXLlrV8lmqgmfMFEYQonWzpKSorwkxZZGc0aYLzhqLKt QO1U0FsiHjSzMpAR8fJVKj5SgEpWCtmbv5wY9y/QTpxKwF3oM8uhLtKBn1Y0OCdTRb/V JV+b5VeM6QdpPRwDs2+TD38rVvzSd4/XwdHQYrIHqAMUBIQbHRvi+OpKPg9LvfjSAdjh AOug== X-Received: by 10.180.103.136 with SMTP id fw8mr14700121wib.27.1357905434107; Fri, 11 Jan 2013 03:57:14 -0800 (PST) X-Mailer: Apple Mail (2.1499) X-Gm-Message-State: ALoCoQlQiyXe7cvCds8NP9BhurY28U5V/4GyBGo43FtGZgF+Pk1nKlRCGDLoWyCoK8uh0JiAOFtH X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:430 Archived-At: Received: from 50-56-192-79.static.cloud-ips.com ([50.56.192.79] helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TtdKf-0000Bx-5N for gclrrg-rainbows-talk@m.gmane.org; Fri, 11 Jan 2013 13:03:33 +0100 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id A3E652E09E; Fri, 11 Jan 2013 12:03:14 +0000 (UTC) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by rubyforge.org (Postfix) with ESMTP id 747162E09B for ; Fri, 11 Jan 2013 12:03:04 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id o1so1888946wic.17 for ; Fri, 11 Jan 2013 04:03:02 -0800 (PST) Received: from [10.3.1.111] (bentranet.plus.com. [212.56.103.158]) by mx.google.com with ESMTPS id i2sm12533558wiw.3.2013.01.11.03.57.13 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 03:57:13 -0800 (PST) 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