From owner-freebsd-threads@FreeBSD.ORG Wed Oct 8 04:45:25 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DEF51065686 for ; Wed, 8 Oct 2008 04:45:25 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (smtp.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id 0AE5B8FC19 for ; Wed, 8 Oct 2008 04:45:24 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id m984KVUc020498 for ; Tue, 7 Oct 2008 22:20:32 -0600 (MDT) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.2/8.14.2) with ESMTP id m983SXao063616 for ; Tue, 7 Oct 2008 21:28:33 -0600 (MDT) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.3/8.14.3/Submit) id m983SXLv063613; Tue, 7 Oct 2008 21:28:33 -0600 (MDT) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18668.10465.699531.162573@gromit.timing.com> Date: Tue, 7 Oct 2008 21:28:33 -0600 X-Mailer: VM 7.19 under Emacs 22.1.1 From: John Hein To: threads@freebsd.org X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on Daffy.timing.com X-Virus-Status: Clean Cc: Subject: pthread_cleanup_push & pthread_cleanup_pop usage X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2008 04:45:25 -0000 In June pthread_cleanup_push & pthread_cleanup_pop were changed to macros that look like so... +#define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ + { \ + struct _pthread_cleanup_info __cleanup_info__; \ + __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ + &__cleanup_info__); \ + { + +#define pthread_cleanup_pop(execute) \ + } \ + __pthread_cleanup_pop_imp(execute); \ + } + This breaks code where the pop is done in an inner block level. simplified example: pthread_cleanup_push(docleanup, &foo); try { dostuff(); } catch (...) { pthread_cleanup_pop(1); throw; } pthread_cleanup_pop(1); Does anyone have a recommended fix?