Re: Challenge: Block Main Thread while Work is done, with Timeout
Re: Challenge: Block Main Thread while Work is done, with Timeout
- Subject: Re: Challenge: Block Main Thread while Work is done, with Timeout
- From: Dave Camp <email@hidden>
- Date: Fri, 24 Jul 2009 07:37:56 -0700
On Jul 23, 2009, at 4:44 PM, Jerry Krinock wrote:
I'd often like to block the main thread while another thread or
process performs a little task, but subject to a short timeout. A
few weeks ago, I was able to achieve this by "running" the main
thread's run loop while an NSTask completed. But I did this after
hours of experimenting and still don't understand how it works.
Today, when I tried to generalize the code, waiting for a little
worker thread instead of an NSTask, my run loop just gets stuck.
The point of using a worker thread is to not block the main thread. If
you are just going to block the main thread you might as well actually
do the work on the main thread.
If you could post what you are trying to do here, there might be
another way to achieve you goals without blocking the main thread.
Dave
_______________________________________________
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