Skip to content

Commit

Permalink
Merge pull request #185 from apple/SR-2856
Browse files Browse the repository at this point in the history
SR-2856 - Robustify dispatch_timer_set_time test
  • Loading branch information
MadCoder committed Oct 12, 2016
2 parents a2665da + 793e629 commit cb59f92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/dispatch_timer_set_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ test_timer(void)
struct timeval end_time;
gettimeofday(&end_time, NULL);
// Make sure we actually managed to adjust the interval
// duration. Seven one second ticks would blow past
// duration. Fifteen one second ticks would blow past
// this.
test_long_less_than("total duration", end_time.tv_sec - start_time.tv_sec, 3);
test_long_less_than("total duration", end_time.tv_sec - start_time.tv_sec, 10);
test_stop();

dispatch_release(s);
});

dispatch_source_set_event_handler(s, ^{
fprintf(stderr, "%d\n", ++i);
if (i >= 7) {
if (i >= 15) {
dispatch_source_cancel(s);
} else if (i == 1) {
dispatch_source_set_timer(s, dispatch_time(DISPATCH_TIME_NOW, 0), NSEC_PER_SEC / 10, 0);
Expand Down

0 comments on commit cb59f92

Please sign in to comment.