Re: pthread_cancel problem on MAC OSX
Re: pthread_cancel problem on MAC OSX
- Subject: Re: pthread_cancel problem on MAC OSX
- From: Jim Magee <email@hidden>
- Date: Mon, 12 Jan 2004 17:31:05 -0500
On Jan 12, 2004, at 1:39 PM, Timothy Standing wrote:
Yes, you're right: pthread_cancel() does nothing. The official word
from Apple is that it will never work. You need to use another method
to get your child threads to finish. Polling a global after a quanta
of work in the child thread is one method.
Where is it stated that pthread_cancel() will never work? As a matter
of fact, it does work today. It's just that most of the defined
cancellation points are currently disabled. You have to add explicit
calls to pthread_testcancel() to recognize a cancellation.
We do plan on addressing that issue (as far as I know, and I should
know, as I have been involved in working on a solution on and off over
the last year or so). The problem is all the other frameworks in Mac
OS X. They are not pthread_cancel() safe [yet] - and we didn't want to
enable all the defined cancellation points until we had a mechanism to
make them work safely together. But we WILL be doing it at some point
in the future (it's always just a matter of timing).
As for Girish's example, adding an explicit call to
pthread_testcancel() in the sleep loop makes it work on Darwin (and
would continue to work on other systems as well). But we understand
that not all programs are as simple as that test case. ;-)
--Jim
Tim Standing
SoftRAID, LLC
On Jan 5, 2004, at 10:00 PM, email@hidden
wrote:
Hi Darwin Devloper,
I am doing some assignments related to thread in user
space.After doing lots of R & D, I came to know that
"pthread_cancel()" is not working properly.The same
program is working fine on Linux.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.