Test dispatchers are parameterized with a scheduler. Several dispatchers can share the same scheduler, in which case their knowledge about the virtual time will be synchronized. When the dispatchers require scheduling an event at a later point in time, they notify the scheduler, which will establish the order of the tasks.
Oliver.O
07/30/2024, 7:44 PM
But admittedly, the notion of
DefaultIoScheduler
doesn't fit into this concept. Why should IO have a different idea of time?
Oliver.O
07/30/2024, 7:51 PM
Seems like with
DefaultIoScheduler
(which is a
ExecutorCoroutineDispatcher
) and others, the names "dispatcher" and "scheduler" are used interchangeably. Possibly something to clean up.
Oliver.O
07/30/2024, 7:54 PM
Other than that, using a test scheduler with anything else than a test dispatcher doesn't seem to make sense: The test dispatcher relies on single-threading to skip time when scheduling jobs. This cannot (easily) work on a multithreaded dispatcher, which would probably not honor a separate scheduler for time keeping anyway.