• 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: How to Delay, Wait, Pause...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to Delay, Wait, Pause...


  • Subject: Re: How to Delay, Wait, Pause...
  • From: Steve Steinitz <email@hidden>
  • Date: Mon, 26 May 2008 08:14:52 +1000

Hi Jens,

Thank you for your clarifications.  I had been left with an unsettled feeling about the technique.

On 25/5/08, Jens Alfke wrote:

> On 25 May '08, at 2:40 AM, Thomas Davie wrote:
>
> >I hate to say this, but any form of delay here is the *wrong*
> >way to do this.  You already know you have a race condition,
> >all you're doing is making it so the race condition will work
> >out in your favor 99.99% of the time.  There are still
> >exceptional cases where the OS will be busy doing something and
> >your 0.1 second sleep will not be enough to sort it out.
> >Instead of doing this, do your threading properly, and get your
> >locking right.

> This is correct advice when it comes to interactions between multiple
> threads; but Steve's problem involves only a single thread. The timing
> here is measured in iterations of the thread's runloop, not in clock
> time. As Dmitri put it:

> >From 10.4 on fetch: results are delayed until the next
> >iteration of the run loop

> So I believe that any technique that cranks the runloop through at
> least one iteration will solve the problem, and that includes any sort
> of timer or perform-after-delay. (I often use

>   performAfterDelay: 0.0,

> though it looks nonsensical on first glance, to delay some action
> until the very next runloop iteration.)

That's a great way to put it, and thanks for yet another useful technique.

Best regards,

Steve

_______________________________________________

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: 
 >Re: How to Delay, Wait, Pause... (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSError and presentError:
  • Next by Date: Re: Quit iTunes
  • Previous by thread: Re: How to Delay, Wait, Pause...
  • Next by thread: Re: How to Delay, Wait, Pause...
  • Index(es):
    • Date
    • Thread