Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8EE769870 for ; Tue, 22 Nov 2011 08:22:54 +0000 (UTC) Received: (qmail 11258 invoked by uid 500); 22 Nov 2011 08:22:54 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 11139 invoked by uid 500); 22 Nov 2011 08:22:48 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 11130 invoked by uid 99); 22 Nov 2011 08:22:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2011 08:22:44 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [195.4.92.94] (HELO mout4.freenet.de) (195.4.92.94) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2011 08:22:33 +0000 Received: from [195.4.92.142] (helo=mjail2.freenet.de) by mout4.freenet.de with esmtpa (ID mypop@freenet.de) (port 25) (Exim 4.76 #5) id 1RSlcL-0002qG-GS for modules-dev@httpd.apache.org; Tue, 22 Nov 2011 09:22:13 +0100 Received: from localhost ([::1]:47569 helo=mjail2.freenet.de) by mjail2.freenet.de with esmtpa (ID mypop@freenet.de) (Exim 4.76 #1) id 1RSlcL-00087Z-Cj for modules-dev@httpd.apache.org; Tue, 22 Nov 2011 09:22:13 +0100 Received: from [195.4.92.21] (port=49567 helo=11.mx.freenet.de) by mjail2.freenet.de with esmtpa (ID mypop@freenet.de) (Exim 4.76 #1) id 1RSlZy-0006yD-Mi for modules-dev@httpd.apache.org; Tue, 22 Nov 2011 09:19:46 +0100 Received: from radzewitz.freenet-ag.de ([62.104.227.65]:54905) by 11.mx.freenet.de with esmtpsa (ID mypop@freenet.de) (TLSv1:CAMELLIA256-SHA:256) (port 25) (Exim 4.76 #1) id 1RSlZy-00057T-Fb for modules-dev@httpd.apache.org; Tue, 22 Nov 2011 09:19:46 +0100 Subject: child init/ exit and the apr_cleanup_register From: michaelr To: modules-dev@httpd.apache.org Content-Type: text/plain; charset="UTF-8" Date: Tue, 22 Nov 2011 09:19:45 +0100 Message-ID: <1321949985.6470.3.camel@radzewitz.freenet-ag.de> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello again, maybe another stupid question but i could not found any example in the modules dir of the httpd source. Let's say i have an child_init_function which opens a filehandle. This filehandle should be open until the child ends. In mod_example.c they register an cleanup function to call a function on child exit. static apr_status_t child_exit ( void *data ) { //close file handle... return OK; } static void child_init ( apr_pool_t *p, server_rec *s ) { //open file handle... apr_pool_cleanup_register(p, s, NULL, child_exit) ; } I understand the cleanup as a function which runs on pool_cleanup. This could happend on any time which i can't control - right? When i return an HTTP_INTERNAL_SERVER_ERROR in my handler function as an example the cleanup get's called also but the child is still alive. The filehandle is closed and on the next request i run into some kind of trouble. Is there a way to define a 'real' exit function or can i force child shutdown in above example? What's the right way to do it correctly? Thanks a lot and greetings Michael