Re: Problem with reading an NSPipe->NSFileHandle to end
Re: Problem with reading an NSPipe->NSFileHandle to end
- Subject: Re: Problem with reading an NSPipe->NSFileHandle to end
- From: Rasmus Skaarup <email@hidden>
- Date: Mon, 12 Apr 2010 15:46:30 +0200
> Try simplifying your app by eliminating the use of background threads. Or, if you feel you must use background threads for long-running computation, use them only for handling the data after receiving it. Do everything involving launching the task and initiating background reads of its output from the main thread (without that bizarre bit about launching a background thread just to have it shunt some work back to the main thread).
I thought that when I added the observers from the main init, and started the tasks by doing performSelectorOnMainThread: from the background thread, it would also start the task on the same thread as the observers - the main thread. But to my suprice, if I add specific observers from startMyTask: (instead of from the main init) everything works perfectly, even though I still initate the task launch from a background thread.
Thanks for your help Ken!
Br
Rasmus Skaarup_______________________________________________
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