Based on the source code, it looks like if the observerables were both to fire OnCompleted
on different threads, then it's possible that the merged observable would fail to complete.
What is an example of unintended consequences arising from Observable.merge<'T> not being thread safe?
-
28-06-2022 - |
Вопрос
The documentation states:
"For each observer, the registered intermediate observing object is not thread safe. That is, observations arising from the sources must not be triggered concurrently on different threads."
This also applies to Observable.pairwise<'T>
and Observable.scan<'U,'T>
.
What is an example of Observable.merge being used in a manner that produces unintended consequences given that it is not thread-safe?
Решение
Другие советы
Generally speaking, thread-safe indicates that using functionality from different threads won't result in race-conditions or deadlocks. In this particular case, I'm going to guess that observations might overwrite each other or otherwise interleave execution in a way which might cause a crash or other unstable states.