Asynchronous IO lags at close
Asynchronous IO lags at close
- Subject: Asynchronous IO lags at close
- From: Justin Delegard <email@hidden>
- Date: Tue, 19 Jan 2010 13:50:56 -0500
I am writing a screen saver that forks a process and reads its stdout
chunk by chunk. Since I didn't want it to block on reads, I tried to
find the non-blocking IO parts of Cocoa. I found Cocoa's
NSNotificationCenter, and the associated methods with the NSFileHandle
class, and that seemed to fit the bill. It works fine *except* it
doesn't notice the closes.
My guess is it has something to do with the main loop being blocked
after the close. It notices the last chunk of data and the close at the
same time, but then it never notices after my
last waitForDataInBackgroundAndNotify call. I don't want the routine
reading the data to be blocked, but I want to know in a timely way if
the file handle is closed. How do I do that? What should I be doing?
Justin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden