(But this question is totally different)
This non-ARC code example sets up a GCD-based timer and it calls dispatch_release for a dispatch_source_t object:
__block BOOL done = NO;
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
if (timer) {
uint64_t milliseconds = 100ull;
uint64_t interval = milliseconds * NSEC_PER_MSEC;
uint64_t leeway = 10ull * NSEC_PER_MSEC;
__block typeof(self) _self = self;
dispatch_source_set_timer(timer, dispatch_walltime(NULL, 0), interval, leeway);
dispatch_source_set_event_handler(timer, ^{
//[_progressBar setProgress:exportSession.progress animated:YES];
if (done) {
dispatch_source_cancel(timer);
dispatch_release(timer);
_self.exportingMovieLabel.hidden = YES;
_self.exportingProgress.hidden = YES;
}
});
dispatch_resume(timer);
}
I learned that you do not have to release queue objects under ARC. But other GCD objects like a dispatch source?