--- Comment #16 from redi at gcc dot gnu dot org 2010-09-10 09:55 ---
There certainly is a race condition: there's no ordering between pthread_cancel
and pthread_testcancel so the main thread can run f2(50) before thread2 calls
pthread_cancel, which is why you see it sometimes run
--- Comment #17 from redi at gcc dot gnu dot org 2010-09-10 10:11 ---
(In reply to comment #15)
In particular, it does not appear that the thread is being reliably cancelled
at the pthread_testcancel call - sometimes f2 seems to run beyond the
pthread_testcancel,
As I said above,
--- Comment #11 from mikedalpee at enginsol dot com 2010-09-02 13:43
---
Created an attachment (id=21663)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21663action=view)
Workaround for the problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #12 from mikedalpee at enginsol dot com 2010-09-02 13:44
---
Created an attachment (id=21664)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21664action=view)
output of the workaround
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #13 from mikedalpee at enginsol dot com 2010-09-02 13:46
---
Simply adding an additional scope to the catch part of the function f2 try
block caused the program to execute properly. So is this a code generation bug
or a glibc bug?
--
--- Comment #14 from mikedalpee at enginsol dot com 2010-09-03 00:05
---
Created an attachment (id=21679)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21679action=view)
Program that demostrates the bug
--
mikedalpee at enginsol dot com changed:
What|Removed
--- Comment #15 from mikedalpee at enginsol dot com 2010-09-03 00:24
---
I have spent a lot more time playing around with this, and after running the
exception1 program numerous times, the behaviour oscillates between working
correctly or not working at all. So there appears to be
--- Comment #1 from mikedalpee at enginsol dot com 2010-09-01 13:13 ---
Created an attachment (id=21633)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21633action=view)
Program that demonstrates the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #2 from mikedalpee at enginsol dot com 2010-09-01 13:13 ---
Created an attachment (id=21634)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21634action=view)
script that builds the bug program
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #3 from mikedalpee at enginsol dot com 2010-09-01 13:16 ---
Created an attachment (id=21635)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21635action=view)
output of the bug program
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #4 from mikedalpee at enginsol dot com 2010-09-01 13:27 ---
Created an attachment (id=21637)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21637action=view)
Expected output of bug program - generated on Solaris 9 using Sun Studio 12.
--
--- Comment #5 from mikedalpee at enginsol dot com 2010-09-01 13:32 ---
This bug occurs across all versions of the compiler I have tested - 4.3, 4.4,
4.5, and 4.6. The bug is preventing me from porting software, because correct
destructor excecution in a cancelled thread is fundamental
--- Comment #6 from rguenth at gcc dot gnu dot org 2010-09-01 13:40 ---
I am sure this is more a pthread implementation issue, so a glibc bug
on sourceware.org/bugzilla would be more appropriate.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--
paolo dot carlini at oracle dot com changed:
What|Removed |Added
Severity|blocker |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #7 from paolo dot carlini at oracle dot com 2010-09-01 13:53
---
Likewise about ICC.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479
--- Comment #8 from pinskia at gcc dot gnu dot org 2010-09-02 00:44 ---
Doing:
catch (int i)
{
Guard g(ioSync);
cout Caught i endl flush;
sched_yield();
pthread_testcancel();
}
Fixes the
--- Comment #9 from mikedalpee at enginsol dot com 2010-09-02 01:13 ---
That fix didn't change the behaviour one bit for me - was there more to it than
just moving the two lines from where they were to the exception handler? Also,
as I am new to this venue, could you please tell me
--- Comment #10 from pinskia at gcc dot gnu dot org 2010-09-02 01:19
---
http://lmgtfy.com/?q=posix+thread+cancel+C%2B%2B+exceptions
the third link is an interesting news group entry.
http://udrepper.livejournal.com/21541.html
etc.
--
18 matches
Mail list logo