• 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: How to kill a thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to kill a thread?


  • Subject: Re: How to kill a thread?
  • From: Philip George <email@hidden>
  • Date: Sun, 19 Jan 2003 14:12:02 -0600

NSThreads cannot be killed without disrupting your memory footprint. I went through this mess thoroughly last year. It took a couple weeks of testing and trying all kinds of different suggestions from other developers (including Apple developers)... it just doesn't work.

But pthreads can be killed with pthread_cancel(). Yes, NSThreads are just objectified pthreads, but they have a lot of other nasty stuff on the backend that can't be dealt with properly in order to kill them off at will.

And pthreads can be used safely in Obj-C apps.

Good luck.

- Philip

PS: straight-C functions can't see global Obj-C instance variables. Any globals that the pthread also needs to see have to be declared outside of any Obj-C class interface. Just take them out of the curlies and paste them up above the "@ interface" line. By the way, if someone knows a better way to deal with this, without having to put globals outside the object, post it, because it can get messy and makes my object less of an "object" every time I have to do it.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: How to kill a thread?
      • From: Mark Levin <email@hidden>
  • Prev by Date: Best app location for general exception handler?
  • Next by Date: Re: How to kill a thread?
  • Previous by thread: Re: How to kill a thread?
  • Next by thread: Re: How to kill a thread?
  • Index(es):
    • Date
    • Thread