Mail Archives: cygwin/2002/06/29/18:09:31
--Apple-Mail-1--163290563
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
This has been submitted to GCC GNATS as PR/7168.
Using the G++ exception system from multiple threads corrupts the gcc's
internal exception stack, due to not including the thread-specific
exception context in the compile.
GCC Version: 2.95.3-5 from default Cygwin install.
I tried to re-compile gcc with --enable-threads=posix and with
--enable-sjlj-exceptions
with no results. The following program is used to determine if the
exception context is thread-specific or not:
--Apple-Mail-1--163290563
Content-Disposition: attachment;
filename=gcc_exception.C
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
x-unix-mode=0644;
name="gcc_exception.C"
#include <stdio.h>
#include <pthread.h>
#include <sys/poll.h>
extern "C" void *
__get_eh_context ();
static void* saved_eh_context = 0;
static void* func(void*) throw(char*)
{
void* eh_cntxt = __get_eh_context();
printf("func() - eh_context = %X\n", eh_cntxt);
if(saved_eh_context == 0)
{
saved_eh_context = eh_cntxt;
}
else
{
if(eh_cntxt == saved_eh_context)
{
printf("FATAL: Identical Exception Stacks!\n");
}
else
{
printf("Great! Exception Stacks Differ.\n");
}
}
int svar = 5;
try {
throw 1;
}
catch(char*)
{
printf("caught string\n");
}
catch(int)
{
// nothing
}
poll(0, 0, 5000);
return 0;
}
int main()
{
pthread_t thr, thr2;
pthread_create(&thr, 0, &func, 0);
poll(0, 0, 1000);
pthread_create(&thr2, 0, &func, 0);
pthread_join(thr, 0);
pthread_join(thr2, 0);
return 0;
}
--Apple-Mail-1--163290563
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
This prevents any sort of complex exception-sensitive multithreaded C++
programs to run in Cygwin/GCC environment.
Thanks for all your help,
Lenny
--Apple-Mail-1--163290563
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--Apple-Mail-1--163290563--
- Raw text -