Post

Replies

Boosts

Views

Activity

Using Combine and RxSwift
We have a question regarding whether or not Combine will mix with RxSwift safely. We have a theory which makes it hard for us to adopt Combine because of heavy RxSwift usage due to the risk of deadlocks. Let us make two assumptions: Combine.Publishers and RxSwift.Observables can be shared, i.e. it is possible for multiple subscriptions to be had to a single source It is thread safe to subscribe to a given Observable or Publisher at any time from any thread and have a defined result Given these assumptions, we can conclude that the frameworks make use of locks to guard their internal state. For RxSwift you can simple look at the source code for instances of "lock". There are many occurrences. While we cannot look at the source for Combine, they aren't exempt from the law. They will either use explicit locks or "synchronization" on objects, which is the same thing. If so, this eventually would result in deadlocks in our application. So, does anyone have thoughts or concerns about if this is a valid theory? Thanks!
0
0
998
Mar ’21