This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: pthreads&exceptions
- To: Assinovski Lev <lev at peterlink dot ru>
- Subject: Re: pthreads&exceptions
- From: Ross Smith <ross dot s at ihug dot co dot nz>
- Date: Fri, 15 Jun 2001 22:13:13 +1200
- CC: gcc-bugs at gcc dot gnu dot org
- Organization: Ihug
- References: <3B29CEF7.42536263@peterlink.ru>
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