• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Thread Cancelation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread Cancelation


  • Subject: Re: Thread Cancelation
  • From: John Stiles <email@hidden>
  • Date: Fri, 29 Oct 2004 14:27:03 -0700

On Oct 29, 2004, at 1:51 PM, Agent M wrote:

On most threading implementations, canceling a thread is a bad idea.
If a thread is sleeping or waiting on a mutex, etc, what, exactly do
you expect to happen? What happens to any memory that code in that
thread allocated? What happens to resources that that thread my have a
lock on? What happens to objects that still have positive retain
counts?

These are all accounted for by POSIX with pthread cleanup handlers or thread-specific memory. Apparently, Darwin doesn't offer the full POSIX functionality of pthread cancel states which means Darwin is deficient. If it is possible to cancel an arbitrary mach thread, then it should be possible to cancel pthreads layered on top of them. The deficiency lies in a number of syscalls which are not cancel-safe.

Maybe this will be fixed in the next release.

Which OSes implement this fully?
I've never even heard of this. It sounds cool from a theoretical perspective, but in practice, trying to write code that can be stopped at any arbitrary point and then asked to clean itself up sounds like an utter nightmare. I think there are only a few programmers in the world who could write bulletproof code in this fashion.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Thread Cancelation (From: Benjohn <email@hidden>)
 >Re: Thread Cancelation (From: Clark Cox <email@hidden>)
 >Re: Thread Cancelation (From: Agent M <email@hidden>)

  • Prev by Date: Re: Const help
  • Next by Date: nextKeyView and NSTabView: How to prevent the tabbing order from going out of the tab view?
  • Previous by thread: Re: Thread Cancelation
  • Next by thread: Re: Thread Cancelation
  • Index(es):
    • Date
    • Thread