Why does this code crash with the try/catch and not without the try/catch?
Compiled and linked with:
g++ -c -mthreads -g -O0 -Wall -o"Main.o" Main.cpp
g++ -mthreads -o./ALibTest.exe Main.o
// Main.cpp
#include <pthread.h>
#include <windows.h>
#include <stdio.h>
void* threadFunction(void * arg)
{
try
{
for ( unsigned long i = 0;i<100;i++)
{
printf("%lu\n",i);
}
return 0;
}
catch(...)
{
}
return 0;
}
int main()
{
pthread_t t1;
pthread_t t2;
pthread_create(&t1, NULL, threadFunction, NULL);
pthread_create(&t2, NULL, threadFunction, NULL);
Sleep(3000); // No semaphore but a simple wait
return 0;
}
Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
email: [EMAIL PROTECTED]
web: www.askesis.nl
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple