• 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 interaction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask interaction


  • Subject: Re: NSTask interaction
  • From: Andreas Monitzer <email@hidden>
  • Date: Tue, 20 Nov 2001 23:13:26 +0100

(I'm the author of that article)

On Tuesday, November 20, 2001, at 07:49 , Finlay Dobbie wrote:

On Monday, November 19, 2001, at 01:18 pm, Kristofer Younger wrote:

I found some stuff on CocoaDevCentral http://www.cocoadevcentral.com/ on how to do this (wrapping a unix command in Cocoa), but found that their solution caused race conditions (I think that's what I experienced) in the Appkit under certain conditions - so I added, in addition to NSTask and NSPipe stuff, some stuff with Distributed Objects to cause the updating of the large amounts of text I get back from the subtask to flow into a TextView without interruption. DO seems to handle it well.
See http://82north.com/volumes/Ditto.dmg.gz for the app and the source to it. (The app does a simple 'ditto' of one folder into another (it's the brainless (and inefficient) way I backup my home directory.))

In fact, I think a better way of doing what they were doing was to use -[NSFileHandle readInBackgroundAndNotify],

readInBackgroundAndNotify doesn't work with disk-based files, I tested that some time ago. That's why "tail -f" uses polling instead of select().

but hey, I digress. I pointed this out to the article writer, but he seemed adamant that there wouldn't be any problems with not doing threads properly. He was under the impresison that the AppKit was thread safe, or something.

Hey, I've changed my mind, ok? :-) My test app ran fine here, but I didn't really stress-test it.

I have since learned otherwise... Anyway, they should probably fix this.

Yes, me too. I'll try to fix that article (don't forget that I'm doing it in my spare time, there's no schedule).
However, that article is about using NSTask, not doing thread-safe AppKit! That's something the Omni folks should know more about.

andy


  • Follow-Ups:
    • Re: NSTask interaction
      • From: Finlay Dobbie <email@hidden>
References: 
 >Re: NSTask interaction (From: Finlay Dobbie <email@hidden>)

  • Prev by Date: Re: Rects and points...
  • Next by Date: Re: NSTask interaction
  • Previous by thread: Re: NSTask interaction
  • Next by thread: Re: NSTask interaction
  • Index(es):
    • Date
    • Thread