RxSwift:确保订阅闭包中的当前线程

RxSwift: ensuring current thread in subscribe closure

问题很简单。是否保证在不调用 observeOn() 的情况下 - 即使用 CurrentThreadScheduler - subscribe() 的关闭在相同的 thread (不是队列)中执行电话?

示例中启动线程 == 观察线程

// <starting thread>
let observable = ... // an observable
observable.subscribe(onNext: { _ in
    // <observer thread>
})

据说 here

When we are doing some operations with Rx, by definition it is all done on the same thread. Unless you don’t change the thread manually, entry point of the chain will begin on the current thread and it will also dispose on the same thread.

此外,默认调度程序是 CurrentThreadScheduler,它在当前线程上进行调度