• 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, NSFileHandle, readInBackgroundAndNotify and avoiding polling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling


  • Subject: Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling
  • From: Jim Correia <email@hidden>
  • Date: Thu, 11 Jul 2002 09:06:04 -0400

On Thursday, July 11, 2002, at 08:36 AM, Andreas Mayer wrote:

Am Donnerstag den, 11. Juli 2002, um 05:41, schrieb Jim Correia:

Is there any way to convince NSFileHandle to only notify me when data is actually available? (waitForDataInBackgroundAndNotify doesn't do the trick, and the docs seem to indicate that readInBackgroundAndNotify is implemented using it).

I'm not sure what's wrong with your code, but this is working for me:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getData:) name:NSFileHandleReadCompletionNotification object:portHandle];
[portHandle readInBackgroundAndNotify];

portHande is a *NSFileHandle;

The test case was broken. Now that I've fixed it I get one notification per chuck of data that becomes available, then a 0 length one when the task closes the pipe (at which time if I then send readInBackgroundAndNotify to the fileHandle, keep getting 0 length notifications).

Jim
_______________________________________________
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: 
 >Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling (From: Andreas Mayer <email@hidden>)

  • Prev by Date: (no subject)
  • Next by Date: Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling
  • Previous by thread: Re: NSTask, NSFileHandle, readInBackgroundAndNotify and avoiding polling
  • Next by thread: Loading a nib for a new window
  • Index(es):
    • Date
    • Thread