• 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 exit a thread help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to exit a thread help...


  • Subject: Re: How to exit a thread help...
  • From: Tom Jones <email@hidden>
  • Date: Mon, 27 Oct 2008 11:38:45 -0700 (PDT)

>> I'm writing a Foundation tool and I need to run a NSTask in a
>> separate thread.


> An NSTask is a different thing from a thread.  Since NSTask provides
> asynchronous notification of its death (and NSFileHandle provides
> asynchronous methods for dealing with I/O), there should be no need to
> use a separate thread to manage a task.

Yes, I'm running the NSTask in a separate thread so that the main run loop will not be effected.I just want the thread to exit once the NSTask is completed.


>> I have it working but when the task completes the thread is still
>> running. I tried issuing a [NSThread exit] but that did nothing.


> By what evidence do you conclude the thread is still running, and
> which thread are you talking about?

If I look at Activity Monitor I can see the number of threads I have, and when the NSTask thread is completed it's still present.


>> What am I missing?


> I suspect it's because you aren't allowing any run loops to run.  See
> the thread beginning here: http://lists.apple.com/archives/Cocoa-dev/2008/Oct/msg01016.html

Thanks,
tom
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: NSPredicateEditor - row size
  • Next by Date: Re: Overridding -[NSPersistentDocument managedObjectContext]
  • Previous by thread: Re: How to exit a thread help...
  • Next by thread: CFPreferences and init.
  • Index(es):
    • Date
    • Thread