File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class AtomicProperty<T> {
27
27
return retVal
28
28
}
29
29
set {
30
- lock. sync {
30
+ lock. async ( flags : DispatchWorkItemFlags . barrier ) {
31
31
self . _property = newValue
32
32
}
33
33
}
@@ -36,7 +36,7 @@ class AtomicProperty<T> {
36
36
var name = " AtomicProperty " + String( Int . random ( in: 0 ... 100000 ) )
37
37
let clzzName = String ( describing: T . self)
38
38
name += clzzName
39
- return DispatchQueue ( label: name)
39
+ return DispatchQueue ( label: name, attributes : . concurrent )
40
40
} ( )
41
41
42
42
init ( property: T ) {
@@ -50,7 +50,7 @@ class AtomicProperty<T> {
50
50
// perform an atomic operation on the atomic property
51
51
// the operation will not run if the property is nil.
52
52
public func performAtomic( atomicOperation: ( ( _ prop: inout T ) -> Void ) ) {
53
- lock. sync {
53
+ lock. sync ( flags : DispatchWorkItemFlags . barrier ) {
54
54
if var prop = _property {
55
55
atomicOperation ( & prop)
56
56
_property = prop
You can’t perform that action at this time.
0 commit comments