MT-safe exceptions?

Teemu Torma tot@trema.com
Mon Sep 8 06:55:00 GMT 1997


Are there any plans to make C++ exceptions multi-thread safe?  Now that
there are maybe working exceptions, it would be nice to use them in
multi-threaded programs.

By looking the generated code, it does not look complicated task (at
least for me, but on the other hand I have only vague idea what it
does).  The problem with current version (egcs-970907) is that it uses
global variables, instead of thread specific ones.  To make it work,
I think the only major thing is to put all the variables into a
structure, and call a routine in libgcc to get one, and possibly only
once in each subroutine, not multiple times like now
__get_dynamic_handler_chain gets called. 

Since it would require special libgcc, maybe an option
-mt={pthread,<other target specific flavor>} that compile with needed
flags (-D_REENTRANT in Solaris) and link with appropriate libraries.

Teemu



More information about the Gcc mailing list