ReactiveX / RxCpp

Reactive Extensions for C++
Apache License 2.0
3.03k stars 390 forks source link

combine_latest thread safe #554

Closed finch-yihe closed 3 years ago

finch-yihe commented 3 years ago

Screenshot from 2021-07-08 16-04-35 when I try to run this code, it turns out that the member is_set of the class rxcpp::util::detail::maybe is false and std::terminal() was called, like this: Screenshot from 2021-07-08 15-07-06 anyone can help me?

finch-yihe commented 3 years ago

how can i promise thread safety about using combine_latest with two different observable in two different thread

nikobarli commented 3 years ago

Try to pass "coordination" to combine_latest, e.g.

o1.combine_latest(rxcpp::observe_on_new_thread(), o2)

For operators receiving it's input from two or more observables injected by multiple threads, you should put coordination to handle the synchronization.

finch-yihe commented 3 years ago

Try to pass "coordination" to combine_latest, e.g.

o1.combine_latest(rxcpp::observe_on_new_thread(), o2)

For operators receiving it's input from two or more observables injected by multiple threads, you should put coordination to handle the synchronization.

thank u