• 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: Challenge: Block Main Thread while Work is done, with Timeout
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Challenge: Block Main Thread while Work is done, with Timeout (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: memory allocation different in simulator and on the iPhone
  • Next by Date: Re: When saving the managed object context
  • Previous by thread: Re: Challenge: Block Main Thread while Work is done, with Timeout
  • Next by thread: Text is flipped vertically
  • Index(es):
    • Date
    • Thread