From: Loren James Rittle <rittle@latour.rsch.comm.mot.com>
To: aurelien.cornet@tms.thomson-csf.com
Cc: gcc@gcc.gnu.org
Subject: Re: Are exception with gcc 2.95.2 thread-safe?
Date: Tue, 21 Mar 2000 14:57:00 -0000 [thread overview]
Message-ID: <200003212256.QAA81207@latour.rsch.comm.mot.com> (raw)
> I try the attached progam on Linux, Sun, Aix:
> In a main procedure, a try block creates a thread, sleep 2s (let the
> thread to be run), then throw an exception. We expected that this
> exception will be catched in main and the program terminates. But this
> program will never terminate and the result is:
> Thread has started
> Exception catched in thread
> Is it a bug? Can we use exception in a multi-threading program?
Your program is operating as it should in the three environments I
have easy access to: Solaris, Linux and FreeBSD. I suspect that there
is a reason why it isn't working for you.
Unfortunately, when you configure gcc, you have to explicitly inform
the process that you want thread safety! E.g.:
../egcs/configure --enable-threads
Then, you have to provide a non-portable-between-gcc-based-
development-environments switch during both compilation and linking:
On Linux and FreeBSD:
g++ -pthread main.C
On Solaris:
g++ -pthreads main.C
On OSF:
EITHER g++ -pthread main.C OR g++ -threads main.C
(but note that depending on which switch you give, your program will
link against a different set of libraries)
Don't ask me why you need to use different options... ;-)
Regards,
Loren
next reply other threads:[~2000-03-21 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-21 14:57 Loren James Rittle [this message]
2000-03-29 1:19 ` aurelien.cornet
-- strict thread matches above, loose matches on Subject: below --
2000-03-21 3:47 aurelien.cornet
2000-03-22 11:04 ` Dima Volodin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200003212256.QAA81207@latour.rsch.comm.mot.com \
--to=rittle@latour.rsch.comm.mot.com \
--cc=aurelien.cornet@tms.thomson-csf.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).