This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: GCC 4.6.2 C++ thread cancellation issue


On 11 May 2012 19:41, Mike Dalpee wrote:
> Ok, I have provided the two examples as attachments. ?I had to transcribe these from printouts, so I apologize if there are any typos that prevent them from immediately compiling.

Both files need
s/pthread tid;/pthread_t tid;/

For the first program I get no abort:

Thread created
In ThreadRun
In Some3rdPartyFunction
Cancelling Thread
Joining cancelled thread
Rethrowing abi::_forced_unwind
Returning from main

Did you mean to put an empty exception specification on the
Some3rdPartyFunction?

For the second I see an abort

Thread created
In ThreadRun
Handling int exception
In Some3rdPartyFunction
Cancelling Thread
Joining cancelled thread
terminate called after throwing an instance of 'int'
Aborted

> I used the following commands to build these:
>
> gcc -g bug1.cpp -o bug1 -lstdc++ -lpthread
> gcc -g bug2.cpp -o bug2 -lstdc++ -lpthread

It won't change the behaviour, but any reason you don't use these
commands instead?

g++ -g bug1.cpp -o bug1 -pthread
g++ -g bug2.cpp -o bug2 -pthread

i.e. compile with the g++ driver so libstdc++ is linked in
automatically, and use -pthread so _REENTRANT is defined, as well as
linking to libpthread.


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