• 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: Agent M <email@hidden>
  • Date: Fri, 29 Oct 2004 16:51:29 -0400


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.

¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬
AgentM
email@hidden
¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬

_______________________________________________
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
  • Follow-Ups:
    • Re: Thread Cancelation
      • From: John Stiles <email@hidden>
References: 
 >Thread Cancelation (From: Benjohn <email@hidden>)
 >Re: Thread Cancelation (From: Clark Cox <email@hidden>)

  • Prev by Date: Autoresizable NSTextField (2)
  • Next by Date: Re: is there a tool that displays object relationships in Cocoa?
  • Previous by thread: Re: Thread Cancelation
  • Next by thread: Re: Thread Cancelation
  • Index(es):
    • Date
    • Thread