From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13370 invoked by alias); 5 Jun 2006 19:08:13 -0000 Received: (qmail 13360 invoked by uid 22791); 5 Jun 2006 19:08:11 -0000 X-Spam-Check-By: sourceware.org Received: from efesto.telvia.it (HELO efesto.telvia.it) (213.155.209.50) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 05 Jun 2006 19:08:05 +0000 Received: from [213.155.205.167] (unverified [213.155.205.167]) by efesto.telvia.it (Vircom SMTPRS 5.3.228) with ESMTP id ; Mon, 5 Jun 2006 21:07:58 +0200 Message-ID: <44848113.6030409@telvia.it> Date: Mon, 05 Jun 2006 19:08:00 -0000 From: Romano Paolo Tenca User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: "Bossom, John" CC: Pthreads-Win32 list Subject: Re: problem in pthread.h References: <4ABB890A1781774888DB6505E6F0E3B36E9606@sottemail2.ent.ad.cognos.com> In-Reply-To: <4ABB890A1781774888DB6505E6F0E3B36E9606@sottemail2.ent.ad.cognos.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2006/txt/msg00035.txt.bz2 Bossom, John wrote: > The pthread_cleanup_push defines a scoped block that is completed by the > pop macro. > This scoping is necessary in order that the internal local variable, > _cleanup, still exists at when the pop is actually called. The pop > expects the values in the _cleanup to still be available. > > Yes, but check the original code: the block is closed in the wrong position. > In pthread.h 2.7.0 line 762 i find: > > #define pthread_cleanup_push( _rout, _arg ) \ > { \ > ptw32_cleanup_t _cleanup; \ > \ > ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) > (_rout), (_arg) ); \ > > #define pthread_cleanup_pop( _execute ) \ > (void) ptw32_pop_cleanup( _execute ); \ > } > > It seems to me that it must be: > > #define pthread_cleanup_push( _rout, _arg ) \ > { \ > ptw32_cleanup_t _cleanup; \ > ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) > (_rout), (_arg) ); \ > } > > #define pthread_cleanup_pop( _execute ) \ > (void) ptw32_pop_cleanup( _execute ); > > > -- Romano Paolo Tenca