• 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: NSTask taking control of my program
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask taking control of my program


  • Subject: Re: NSTask taking control of my program
  • From: Nick Zitzmann <email@hidden>
  • Date: Fri, 26 Sep 2003 00:13:56 -0700

On Thursday, September 25, 2003, at 11:45 PM, Chad Armstrong wrote:

I'm doing some work with NSTask, and something does not seem to be working how I expected it should. From my own understanding, and even after reading through some of Apple's websites on NSTask, it seems that when an NSTask is launched, it is its own process. And if it is its own separate process from the parent program, shouldn't it run separately, and not necessarily affect the parent? In my program, when I run the task, I want to have a Cancel/Stop option to terminate the task if I wish, however, when the program was running, I couldn't click on any buttons to kill the task. It seems that the task has taken control over the parent application, stopping any further interaction until the task is complete.

What might I be missing here, or is my concept of what the NSTask is doing skewed?

Did you run the task in the main thread, and then call -waitUntilExit, or run some loop to run until the task finishes? If so, then your application will stop responding to events until whatever you're doing in the main thread is finished. This is because AppKit does all of its event processing in the main thread, and if the main thread is busy...

But if you run your NSTask control stuff in another thread, then the main thread will be free to process events. Or, if you do have a loop that runs as long as the task is up, you could run the run loop for a very short amount of time within that loop (which should work in theory, but I haven't tried it).

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://seiryu.home.comcast.net/

"I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." - Bjarne Stroustrup
_______________________________________________
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.
References: 
 >NSTask taking control of my program (From: Chad Armstrong <email@hidden>)

  • Prev by Date: NSTask taking control of my program
  • Next by Date: Non-View Text Engine
  • Previous by thread: NSTask taking control of my program
  • Next by thread: Re: NSTask taking control of my program
  • Index(es):
    • Date
    • Thread