From owner-freebsd-current Fri Nov 19 15:31:11 1999 Delivered-To: freebsd-current@freebsd.org Received: from vip.consys.com (VIP.ConSys.COM [209.141.107.6]) by hub.freebsd.org (Postfix) with ESMTP id 88C2F1508F for ; Fri, 19 Nov 1999 15:31:07 -0800 (PST) (envelope-from rcarter@pinyon.org) Received: (from pinyon@localhost) by vip.consys.com (8.9.3/8.9.1) id QAA63190; Fri, 19 Nov 1999 16:31:06 -0700 (MST) Date: Fri, 19 Nov 1999 16:31:06 -0700 (MST) From: "Russell L. Carter" Message-Id: <199911192331.QAA63190@vip.consys.com> To: freebsd-current@freebsd.org Subject: threads, exceptions, and current Cc: rcarter@vip.consys.com Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I'm trying to track down a problem with threads, C++ exceptions and ACE on -current. Is the appended little program supposed to work? If not, why not? It SIGABRTs immediately after the last throw with egcs-2.95.2, and also with a month old or so egcs-2.91.66, stock cc. Also with LinuxThreads, so it's not libc_r specific. I am told but cannot verify at the minute that this works on other platforms. Thanks, Russell $ c++ -pthread -D_THREAD_SAFE ex_test.cpp $ ./a.out Throwing Ex: Caught Ex, now rethrowing it... Caught Ex thrown from main thread. Throwing Ex: Caught Ex, now rethrowing it... Abort trap (core dumped) $ ex_test.cpp: #include #include class Ex {}; class testEx { public: void throwEx () { fprintf(stderr, "Throwing Ex:\n"); throw Ex (); } }; void * f(void *) { testEx thetest; thetest.throwEx (); } void * g(void *arg) { try { f(arg); } catch (Ex &ex) { fprintf(stderr, "Caught Ex, now rethrowing it...\n"); throw; } } int main (void) { int *arg = 0; try { g((void *) arg); } catch (Ex &ex) { fprintf(stderr, "Caught Ex thrown from main thread.\n"); } pthread_t ex_thread; pthread_attr_t *attr = 0; try { pthread_create(&ex_thread, attr, g, (void *) arg); } catch (Ex &ex) { fprintf(stderr, "Caught Ex thrown from child thread.\n"); } pthread_join(ex_thread, (void **) &arg); return 0; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message