• 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: Async output ready notification for file descriptors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Async output ready notification for file descriptors


  • Subject: Re: Async output ready notification for file descriptors
  • From: Glenn Andreas <email@hidden>
  • Date: Wed, 10 Sep 2003 10:36:11 -0500

At 10:16 AM -0400 9/10/03, Brian Adamson wrote:
Does anyone know a non-multithreaded approach in Cocoa for getting asynchronous notification of _output_ readiness for non-blocking file descriptors (associated with pipes, sockets, files, devices, etc)?

Asynchronous notification is readily available for _input_ readiness by using the NSFileHandle object and its "waitForDataInBackgroundAndNotify" method to get "NSFileHandleDataAvailableNotification" ...

If you neeed a non-multithreaded approach (and are using waitForDataInBackgroundAndNotify), you're already out of luck, since, according to the documentation for NSFileHandle:


waitForDataInBackgroundAndNotify

- (void)waitForDataInBackgroundAndNotify
Checks to see if data is available in a background thread. When the data becomes available, the thread notifies all observers with NSFileHandleDataAvailableNotification. After the notification has been posted, the thread is terminated.

So if you use waitForDataInBackgroundAndNotify it is already implicitly multi-threaded (in which case, making a "waitForOutputReadyInBackgroundAndNotify" method using threads built on top of "writeData" would be straightforward).


--
Glenn Andreas email@hidden Theldrow, Blobbo, Cythera, oh my!
Be good, and you will be lonesome
_______________________________________________
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: 
 >Async output ready notification for file descriptors (From: Brian Adamson <email@hidden>)

  • Prev by Date: RE: replaceOccurrencesOfString not recognized?
  • Next by Date: Re: Async output ready notification for file descriptors
  • Previous by thread: Async output ready notification for file descriptors
  • Next by thread: Re: Async output ready notification for file descriptors
  • Index(es):
    • Date
    • Thread