Skip to content

Commit 5a16bda

Browse files
committed
fix lock
1 parent 96d3bcd commit 5a16bda

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Lifecycle/AutoCancel/AutoCancel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ extension Subscribers {
132132
}
133133

134134
public func receive(subscription: Subscription) {
135-
lock.lock(); defer { lock.lock() }
135+
lock.lock(); defer { lock.unlock() }
136136

137137
self.subscription = subscription
138138

@@ -143,14 +143,14 @@ extension Subscribers {
143143
}
144144

145145
public func receive(_ input: Input) -> Subscribers.Demand {
146-
lock.lock(); defer { lock.lock() }
146+
lock.lock(); defer { lock.unlock() }
147147

148148
receivers?.receiveValue?(input)
149149
return .unlimited
150150
}
151151

152152
public func receive(completion: Subscribers.Completion<Failure>) {
153-
lock.lock(); defer { lock.lock() }
153+
lock.lock(); defer { lock.unlock() }
154154

155155
receivers?.receiveCompletion?(completion)
156156

@@ -165,7 +165,7 @@ extension Subscribers {
165165
}
166166

167167
public func cancel() {
168-
lock.lock(); defer { lock.lock() }
168+
lock.lock(); defer { lock.unlock() }
169169

170170
guard subscription != nil else {
171171
clear()

0 commit comments

Comments
 (0)