Revision: 13810
          http://sourceforge.net/p/skim-app/code/13810
Author:   hofman
Date:     2023-11-25 17:13:40 +0000 (Sat, 25 Nov 2023)
Log Message:
-----------
use dispatch_once for shared readers

Modified Paths:
--------------
    trunk/SkimNotes/SKNSkimReader.m
    trunk/SkimNotes/SKNXPCSkimReader.m

Modified: trunk/SkimNotes/SKNSkimReader.m
===================================================================
--- trunk/SkimNotes/SKNSkimReader.m     2023-11-25 16:47:50 UTC (rev 13809)
+++ trunk/SkimNotes/SKNSkimReader.m     2023-11-25 17:13:40 UTC (rev 13810)
@@ -47,8 +47,10 @@
 
 + (id)sharedReader {
     static id sharedReader = nil;
-    if (nil == sharedReader)
+    static dispatch_once_t onceToken = 0;
+    dispatch_once(&onceToken, ^{
         sharedReader = [[self alloc] init];
+    });
     return sharedReader;
 }
 

Modified: trunk/SkimNotes/SKNXPCSkimReader.m
===================================================================
--- trunk/SkimNotes/SKNXPCSkimReader.m  2023-11-25 16:47:50 UTC (rev 13809)
+++ trunk/SkimNotes/SKNXPCSkimReader.m  2023-11-25 17:13:40 UTC (rev 13810)
@@ -46,8 +46,10 @@
 
 + (id)sharedReader {
     static id sharedReader = nil;
-    if (nil == sharedReader)
+    static dispatch_once_t onceToken = 0;
+    dispatch_once(&onceToken, ^{
         sharedReader = [[self alloc] init];
+    });
     return sharedReader;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to