Skip to content

Commit 60a9c36

Browse files
authored
Add additional locking in DemandBuffer to protect demandState (#90)
1 parent 730d272 commit 60a9c36

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/Common/DemandBuffer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class DemandBuffer<S: Subscriber> {
4343
func buffer(value: S.Input) -> Subscribers.Demand {
4444
precondition(self.completion == nil,
4545
"How could a completed publisher sent values?! Beats me 🤷‍♂️")
46+
lock.lock()
47+
defer { lock.unlock() }
4648

4749
switch demandState.requested {
4850
case .unlimited:

0 commit comments

Comments
 (0)