Cygwin v1.7.5: Destructor NOT Invoked In Threads Upon Thread Cancellation (Windows XP SP 3)

Ken ken.ng@martoneradiotech.com
Tue Apr 13 08:21:00 GMT 2010


To whom this may concern,

Under Fedora Core 6 (Linux), compiling and executing the attached test
code with:
   "g++ test.cpp -lpthread; ./a.out"
produces the following expected output:

OUTPUT (Fedora Core 6):
-----------------------
constructor
destructor
constructor
destructor

However, under Cygwin v1.7.5, compiling and executing the attached test
code with
the same exact command produces the following unexpected output:

OUTPUT (Cygwin v1.7.5):
-----------------------
constructor
destructor
constructor

As per POSIX spec from the following link:
   "http://www.opengroup.org/onlinepubs/009695399/"

The description for the "pthread_cancel()" method is:

   The pthread_cancel() function shall request that thread be canceled.
The target
thread's cancelability state and type determines when the cancellation
takes effect.
When the cancellation is acted on, the cancellation cleanup handlers for
thread shall
be called.  When the last cancellation cleanup handler returns, the
thread-specific
data destructor functions shall be called for thread.  When the last
destructor
function returns, thread shall be terminated.

     The cancellation processing in the target thread shall run
asynchronously with
respect to the calling thread returning from pthread_cancel().

Thanks,
Ken


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100413/1c40d076/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100413/1c40d076/attachment-0001.ksh>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list