Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 14910 invoked by uid 500); 24 Jan 2002 12:53:31 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 14899 invoked from network); 24 Jan 2002 12:53:31 -0000 From: "Sander Striker" To: Subject: RE: cvs commit: apr/memory/unix apr_pools.c Date: Thu, 24 Jan 2002 13:57:09 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: <20020124121818.57396.qmail@icarus.apache.org> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Rcpt-To: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > From: striker@apache.org [mailto:striker@apache.org] > Sent: 24 January 2002 13:18 > To: apr-cvs@apache.org > Subject: cvs commit: apr/memory/unix apr_pools.c > > striker 02/01/24 04:18:18 > > Modified: . configure.in > memory/unix apr_pools.c > Log: > Introduce a new configure option: --enable-pool-debug > This allows us to select the pools debug mode at configure > time without messing about in source files. > > At the same time we switch to a flag system, so different > debug features can be switched on or off. e.g.: > --enable-pool-debug="verbose lifetime" > > Revision Changes Path > 1.400 +41 -0 apr/configure.in Introduction to the debug modes: ./configure --enable-pool-debug ; default debug mode (malloc system) ./configure --enable-pool-debug=yes ; same ./configure --enable-pool-debug=verbose ; verbose output ./configure --enable-pool-debug=lifetime ; lifetime checking ./configure --enable-pool-debug=owner ; owner checking ./configure --enable-pool-debug=all ; enable all debug modes The general debug mode (which is always enabled when any debug mode is selected) gives you a malloc using system for each allocation. This is extremely usefull in combination with electric fence (--with-efence) or other third party tools like purify. The verbose mode gives you output on stderr (which in httpd is redirected to the error_log). It gives you information on events, like pool creation (CREATE), pool clear (CLEAR), etc. It also gives you stats, pid/tid, tag. This can easily be modified by changing apr_pool_log_event in apr_pools.c. The lifetime option checks if the pool is still a relative of the global pool on every pool operation. If not, the pool was previously destroyed and we abort. The owner option checks if the pool being used is owned by the current thread performing the operation. If not, we abort. The ownership of the pool can be transferred using apr_pool_set_owner*. Sander *) apr_pool_set_owner was not part of this commit. It gave me some trouble to where to put it. I had a function like this: APR_DECLARE(void) apr_pool_set_owner(apr_pool_t *pool, apr_os_thread_t tid); This declaration can only be placed in apr_portable.h (due to circular dependencies), which is a lousy location for a debug function. The other approach is to use apr_thread_t *, but I couldn't find the way to do: apr_thread_equal(thread1, thread2); /* where thread1 and 2 * are apr_thread_t * */ Or apr_thread_current() which gives me, or fills an apr_thread_t * with the current thread info. So, either I'm looking with my eyes shut, or the thread API is lacking some functionality.