Re: repeating timer with "run now"
Re: repeating timer with "run now"
- Subject: Re: repeating timer with "run now"
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 22 Aug 2013 16:26:06 +0200
Le 22 août 2013 à 16:08, Torsten Curdt <email@hidden> a écrit :
>> Why not just keeping a reference on your scheduled block and simply call dispatch_async when you want to execute it immediately ?
>
> It would not re-schedule the timer. So the block could potentially be
> run twice without much of the desired delay in between.
>
> The logic should be something along the lines of
>
> def run_now
> invalidate timer (if there is one running)
> run block
> schedule timer to run block in x seconds
> end
>
> Just to explain the desire behaviour.
OK, so I think you can just call dispatch_source_set_timer() each time you want to immediately execute your timer and reschedule it, passing 'now' as 'start' argument and your interval as 'interval' argument.
-- Jean-Daniel
_______________________________________________
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