Browse Source

同步锁

harry 3 năm trước cách đây
mục cha
commit
d549641536
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

+ 5 - 0
BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

@@ -933,3 +933,8 @@ public func currentBundlePath() -> Bundle?{
     return Bundle(url: associateBundleURL!)
 }
 
+public func synced(_ lock: Any, closure: () -> ()) {
+    objc_sync_enter(lock)
+    closure()
+    objc_sync_exit(lock)
+}