소스 검색

同步锁

harry 3 년 전
부모
커밋
d549641536
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  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)
+}