Re: Async output ready notification for file descriptors
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.