[vlc-devel] [PATCH 01/13] VLCKit: Make +nullTime access thread safe

Florent Pillet fpillet at gmail.com
Mon Jul 7 12:41:16 CEST 2014


---
 Sources/VLCTime.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Sources/VLCTime.m b/Sources/VLCTime.m
index dac9d4e..dbd6340 100644
--- a/Sources/VLCTime.m
+++ b/Sources/VLCTime.m
@@ -25,12 +25,15 @@
 #import "VLCTime.h"
 
 @implementation VLCTime
+
 /* Factories */
 + (VLCTime *)nullTime
 {
     static VLCTime * nullTime = nil;
-    if (!nullTime)
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
         nullTime = [VLCTime timeWithNumber:nil];
+    });
     return nullTime;
 }
 
-- 
1.8.5.2 (Apple Git-48)




More information about the vlc-devel mailing list