1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Fixes -invalidate: cancel the dispatch source, don't just suspend it, and wait until that is done.

This commit is contained in:
Thomas Harte 2020-02-02 21:29:22 -05:00
parent 0310f94f0c
commit 256f4a6679

View File

@ -31,7 +31,15 @@
}
- (void)invalidate {
dispatch_suspend(_timer);
NSConditionLock *lock = [[NSConditionLock alloc] initWithCondition:0];
dispatch_source_set_cancel_handler(_timer, ^{
[lock lock];
[lock unlockWithCondition:1];
});
dispatch_source_cancel(_timer);
[lock lockWhenCondition:1];
}
@end