Skip to content

Commit

Permalink
Make Property.on() thread-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
aethe authored May 29, 2019
1 parent bd4852d commit 0d4b499
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Property.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public final class Property<Value>: PropertyProtocol, SubjectProtocol, BindableP
}

public func on(_ event: Event<Value, Never>) {
lock.lock(); defer { lock.unlock() }
if case .next(let element) = event {
_value = element
}
Expand Down

0 comments on commit 0d4b499

Please sign in to comment.