GCDTimer icon indicating copy to clipboard operation
GCDTimer copied to clipboard

dispatch after misuse

Open jonasman opened this issue 10 years ago • 1 comments
trafficstars

  dispatch_source_set_timer(timer,
                                dispatch_time(DISPATCH_TIME_NOW, 0), --------> Configure here the start time, put the interval with dispatch_time or dispatch_walltime
                              interval * NSEC_PER_SEC,
                              0);

   ....

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, interval * NSEC_PER_SEC), queue, ^{
        dispatch_resume(timer);
    }); -----> just resume normally now, no more dispathc_after

jonasman avatar May 05 '15 15:05 jonasman

  dispatch_source_set_timer(timer,
                                dispatch_time(DISPATCH_TIME_NOW, 0), --------> Configure here the start time, put the interval with dispatch_time or dispatch_walltime
                              interval * NSEC_PER_SEC,
                              0);

   ....

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, interval * NSEC_PER_SEC), queue, ^{
        dispatch_resume(timer);
    }); -----> just resume normally now, no more dispathc_after

no no no The first run will also be after 1 second effect equals NSTimer NSTimer scheduledTimerWithTimeInterval:1 repeats:YES block:^...

coooliang avatar Oct 26 '18 06:10 coooliang