From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C0A8C1FE1C; Wed, 23 Sep 2015 09:31:03 +0000 (UTC) Date: Wed, 23 Sep 2015 09:31:03 +0000 From: Eric Wong To: "Lin Jen-Shin (godfat)" Cc: yahns-public@yhbt.net Subject: Re: -1 shutdown_timeout? Message-ID: <20150923093103.GA23550@dcvr.yhbt.net> References: <20150923080504.GA19141@dcvr.yhbt.net> <20150923083025.GA22196@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: "Lin Jen-Shin (godfat)" wrote: > Just tried it, but not sure where to put this. > With preload=true, yahns is trapping later than > the application. Maybe I should just set it to false > since we're not forking anyway... Anywhere in your normal app dispatch path, just initialize the lock during application load (regardless of preload value) def initialize(...) @lock = Mutex.new @old_quit = nil end def call(env) unless @old_quit @lock.synchronize do @old_quit ||= trap(:QUIT) do app_specific_quit @old_quit.call end end end ... end