Date: Thu, 2 Dec 1999 11:13:24 -0700 (MST) From: rcarter@pinyon.org To: FreeBSD-gnats-submit@freebsd.org Subject: misc/15228: C++ exceptions+threads fail Message-ID: <19991202181324.CCF5456@pinyon.org>
next in thread | raw e-mail | index | archive | help
>Number: 15228
>Category: misc
>Synopsis: C++ exceptions+threads SIGABRTs.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 2 10:20:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Russell L. Carter
>Release: FreeBSD 4.0-CURRENT i386
>Organization:
Conceptual Systems & Software
>Environment:
standard -current
>Description:
Throwing a c++ exception across threads causes core dump.
>How-To-Repeat:
$ 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 <stdio.h>
#include <pthread.h>
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;
}
>Fix:
None yet.
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991202181324.CCF5456>
