File tree Expand file tree Collapse file tree 3 files changed +4
-9
lines changed
Sources/KakaJSON/Metadata Expand file tree Collapse file tree 3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 33---
44
55## [ 1.1.1] ( https://github.com/kakaopensource/KakaJSON/releases/tag/1.1.1 ) (2019-11-04)
6+ - Adjust Lock
67- Closed issues
78 - [iOS 9 Crash](https://github.com/kakaopensource/KakaJSON/issues/31)
89- Merged pull requests
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ public struct Metadata {
1313 private static var types = [ TypeKey: BaseType] ( )
1414
1515 public static func type( _ type: Any . Type ) -> BaseType ? {
16+ typeLock. lock ( )
17+ defer { typeLock. unlock ( ) }
18+
1619 // get from cache
1720 let key = typeKey ( type)
1821 if let mt = types [ key] { return mt }
@@ -23,11 +26,6 @@ public struct Metadata {
2326 || name == " NSObject "
2427 || name == " _TtCs12_SwiftObject " { return nil }
2528
26- typeLock. lock ( )
27- defer { typeLock. unlock ( ) }
28- // judge after lock
29- if let mt = types [ key] { return mt }
30-
3129 // type judge
3230 var mtt : BaseType . Type
3331 let kind = Kind ( type)
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ public class ModelType: BaseType {
1818
1919 func modelKey( from propertyName: String ,
2020 _ createdKey: @autoclosure ( ) -> ModelPropertyKey ) -> ModelPropertyKey {
21- if let key = modelKeys [ propertyName] { return key }
22-
2321 modelKeysLock. wait ( )
2422 defer { modelKeysLock. signal ( ) }
2523 if let key = modelKeys [ propertyName] { return key }
@@ -31,8 +29,6 @@ public class ModelType: BaseType {
3129
3230 func JSONKey( from propertyName: String ,
3331 _ createdKey: @autoclosure ( ) -> String ) -> String {
34- if let key = jsonKeys [ propertyName] { return key }
35-
3632 jsonKeysLock. wait ( )
3733 defer { jsonKeysLock. signal ( ) }
3834 if let key = jsonKeys [ propertyName] { return key }
You can’t perform that action at this time.
0 commit comments