This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: pthreads&exceptions


Assinovski Lev wrote:
> 
> Hello!
> I use egcs-2.91.66 in Linux version 2.2.5-15 (Redhat 6.0).
> I can't catch exception in main() if it is thrown
> from a function which is in thread (pthread).
> I get "Aborted" instead.
> Could you advise me how to fix that?

"Doctor, it hurts when I do this!"
"Don't do that then."

There's no standard for this (C++ says nothing about threads, and Posix
says nothing about C++), but it should be obvious that exceptions must
not be propagated from one thread to another. If they were, it would be
impossible to write exception-safe code, since an exception could
potentially pop up anywhere. You can expect a program that attempts to
do this to abort.

(By the way, the compiler you're using is _way_ out of date.)

-- 
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army."                  -- Neal Stephenson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]