Revisit to Threads and Exceptions
mdp@mindpass.com
mdp@mindpass.com
Tue May 9 01:59:00 GMT 2000
Hi gcc's
My program crashes when I have several threads throwing exceptions BUT it
only crashes when I use gcc-2.95.2 and not my system default gcc
(egcs-2.91.66)
Take a look at my program:
#include <stdio.h>
#include <pthread.h>
#define NUM_THREADS 10
pthread_t t[NUM_THREADS];
void * throwcatch(void *p) {
while(true) {
try {
throw 1;
} catch(...) {
}
}
}
int main(int argc, char **argv) {
int rtn, idx;
unsigned long int ret;
for(idx = 0; idx < NUM_THREADS; idx++) {
rtn = pthread_create(&t[idx],NULL,throwcatch, NULL);
}
for(idx = 0; idx < NUM_THREADS; idx++) {
pthread_join(t[idx], NULL);
}
}
I'm running an Intel RedHat 6.1 installation, and have manually installed
gcc-2.95.2 with the following configure string:
./configure
--with-gcc-version-trigger=/pack/gcc-2.95.2_kernel-2.2.12/src/gcc/version.c
--host=i686-pc-linux-gnu --prefix=/pack/gcc-2.95.2_kernel-2.2.12
--norecursion --enable-threads
The error occurs more easily (after a few secs) when running on a multi CPU
box, but eventually it also crashes on a single CPU (may take several
minutes).
Is this a bug in gcc-2.95.2 or is it a misconfiguration of my system?
--
Martin D. Pedersen (mdp@mindpass.com)
Developer at MINDPASS A/S, http://www.mindpass.com
Business: +45 96353218
More information about the Gcc-bugs
mailing list