Skip to content

Commit

Permalink
Merge pull request #223 from aethe/master
Browse files Browse the repository at this point in the history
Make Property.on() thread-safe
  • Loading branch information
srdanrasic authored Jun 21, 2019
2 parents 3d82fba + 0d4b499 commit 1079e92
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 @@ -60,6 +60,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 1079e92

Please sign in to comment.