October 2018
Intermediate to advanced
420 pages
10h 26m
English
The NewThread scheduler spawns new threads to emit items. Depending on the operator being used to control scheduling, it spawns a new thread either for each subscription or for each emitted item. Its prototype is the following one:
NewThreadScheduler.__init__(self, thread_factory=None)
The optional thread_factory argument can be provided as an alternative way to spawn threads. If no thread factory is provided, the scheduler uses the threading.Thread class to spawn new threads and configures them as daemon threads.
The NewThreadScheduler object can be used as a parameter of a factory operator, or as a parameter of the subscribe_on operator to control source observable emissions:
from rx import Observablefrom rx.concurrency ...