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

Re: NSFileHandle notifications


  • Subject: Re: NSFileHandle notifications
  • From: Chris Kane <email@hidden>
  • Date: Tue, 31 Jul 2001 11:11:02 -0700

On Monday, July 30, 2001, at 03:47 PM, Andreas Monitzer wrote:
[...]
However, when this code is run the notifications are constantly sent ("Notification without data!") and the CPU utilization is at about 25% even when nothing happens. "waitForData" doesn't sound like it should send notifications when no data is available. Can anyone confirm/deny/explain this?
I think I'll implement it myself by using select().

Why not have the file handle do the reading for you with -readInBackgroundAndNotify? I'm not sure waitForDataInBackgroundAndNotify (which uses select()) works well (gives the semantics you're expecting) on real files (as opposed to pipes or sockets).

The no-data could be because there is an error occurring (say, in the background wait) or because no data has been added to the file (your fd is still "at EOF") but select() is returning the file descriptor as readable anyway.

In any case, I'd try converting to -readInBackgroundAndNotify.


Chris Kane
Cocoa Frameworks, Apple


  • Follow-Ups:
    • Re: NSFileHandle notifications
      • From: Andreas Monitzer <email@hidden>
    • Re: NSFileHandle notifications
      • From: Finlay Dobbie <email@hidden>
    • Re: NSFileHandle notifications
      • From: Charles Bennett <email@hidden>
  • Prev by Date: Re: Bundles: debugging and more
  • Next by Date: Re: Looping worker threads - NSString vs sprintf
  • Previous by thread: NSTableView and Strings follow up
  • Next by thread: Re: NSFileHandle notifications
  • Index(es):
    • Date
    • Thread