Revision: 27914
http://sourceforge.net/p/bibdesk/svn/27914
Author: hofman
Date: 2022-09-20 17:02:23 +0000 (Tue, 20 Sep 2022)
Log Message:
-----------
check for async object being started using GCD
Modified Paths:
--------------
trunk/bibdesk/BDSKAsyncObject.h
trunk/bibdesk/BDSKAsyncObject.m
Modified: trunk/bibdesk/BDSKAsyncObject.h
===================================================================
--- trunk/bibdesk/BDSKAsyncObject.h 2022-09-20 14:04:09 UTC (rev 27913)
+++ trunk/bibdesk/BDSKAsyncObject.h 2022-09-20 17:02:23 UTC (rev 27914)
@@ -45,7 +45,7 @@
BOOL stopRunning;
_Atomic(BOOL) shouldKeepRunning;
#ifdef DEBUG
- _Atomic(BOOL) didStart;
+ BOOL didStart;
#endif
}
Modified: trunk/bibdesk/BDSKAsyncObject.m
===================================================================
--- trunk/bibdesk/BDSKAsyncObject.m 2022-09-20 14:04:09 UTC (rev 27913)
+++ trunk/bibdesk/BDSKAsyncObject.m 2022-09-20 17:02:23 UTC (rev 27914)
@@ -47,14 +47,6 @@
@dynamic shouldKeepRunning;
-#ifdef DEBUG
-- (void)checkStartup:(NSTimer *)ignored
-{
- if (NO == atomic_load(&didStart))
- NSLog(@"*** Warning *** %@ has not been started after 1 second", self);
-}
-#endif
-
- (id)init
{
self = [super init];
@@ -63,10 +55,12 @@
shouldKeepRunning = YES;
#ifdef DEBUG
didStart = NO;
-
// check for absentminded developers; there's no actual requirement
that start be called immediately
- [NSTimer scheduledTimerWithTimeInterval:1.0 target:self
selector:@selector(checkStartup:) userInfo:nil repeats:NO];
-#endif
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (NO == didStart)
+ NSLog(@"*** Warning *** %@ has not been started", self);
+ });
+#endif
stopRunning = NO;
}
@@ -78,7 +72,7 @@
- (void)start;
{
#ifdef DEBUG
- atomic_store(&didStart, YES);
+ didStart = YES;
#endif
// run a background thread
localThread = [[NSThread alloc] initWithTarget:self
selector:@selector(runLocalThread) object:nil];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit