From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18884 invoked by alias); 7 Nov 2002 20:18:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 18866 invoked from network); 7 Nov 2002 20:18:43 -0000 Received: from unknown (HELO desire.geoffk.org) (12.235.56.190) by sources.redhat.com with SMTP; 7 Nov 2002 20:18:43 -0000 Received: (from geoffk@localhost) by desire.geoffk.org (8.11.6/8.11.6) id gA7KIZH02553; Thu, 7 Nov 2002 12:18:35 -0800 X-Authentication-Warning: desire.geoffk.org: geoffk set sender to geoffk@geoffk.org using -f To: Mark Mitchell Cc: Zack Weinberg , Richard Henderson , Jakub Jelinek , Aldy Hernandez , "gcc-patches@gcc.gnu.org" , "jason@redhat.com" Subject: Re: [basic-improvements] try/finally support for c/c++ - more tests References: <19940000.1036685525@warlock.codesourcery.com> From: Geoff Keating Date: Thu, 07 Nov 2002 12:18:00 -0000 In-Reply-To: <19940000.1036685525@warlock.codesourcery.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-11/txt/msg00494.txt.bz2 Mark Mitchell writes: > We're trying to implement one particular piece of functionality required > by the POSIX threads interface; namely "pthread_cleanup_push" and friends. > (I know that any feature might get used more widely, but this is the > motivation, as I understand it.) Furthermore, we're trying to make the > POSIX threads cleanups play nice with exception-handling. Yes, this is right, but your example is not the case we really care about. What we particularly want to make work is this C++ code: struct A { ~A() { ... } }; { A foo; sigpause (); // cancellation point, I hope } Here, if 'sigpause' gets cancelled, we want A's destructor to not be run. At present, cancellation is implemented using setjmp/longjmp, and so knows nothing about C++ destructors, and so this doesn't work. If we made C++ use setjmp/longjmp for destructors, that would be very expensive for all C++ code. Instead, we want to make cancellation use the C++ exception mechanism, because that's already there and so wouldn't impose any extra overhead on C++ code. The problem is that then we can't implement pthread_cleanup_push in C, because C can't interact with the exception mechanism. -- - Geoffrey Keating