So the identity of the dispatcher might sometimes be important
c
CLOVIS
06/05/2024, 8:26 AM
Where is the event loop implemented? Will that allow both dispatchers to start tasks in parallel? (AFAIK
runTest
is single-threaded?)
s
Sam
06/05/2024, 8:34 AM
The dispatcher is mostly just a wrapper around the
TestCoroutineScheduler
, which is what contains the event loop. The
runTest
function just grabs the scheduler from the
TestScope
and runs its event loop.
Sam
06/05/2024, 8:35 AM
So you wouldn't be able to use two different schedulers, unless you were manually advancing the event loop somehow. As far as I understand it, the scheduler has to be wired up to the
runTest
function for it to actually start running anything.
c
CLOVIS
06/05/2024, 9:24 AM
Ah, I see. I always confuse schedulers and dispatchers
s
Sam
06/05/2024, 9:26 AM
I think the distinction is only really made for test dispatchers. Elsewhere in the coroutines library, dispatcher and scheduler seem to be mostly synonymous.