Well we are discussing models in general.
If you do not want preemption disable it. For example in posix threads use sched_fifo and pin to one core.
Loom might provide similar features if needed.
If you do not want preemption disable it. For example in posix threads use sched_fifo and pin to one core.
Loom might provide similar features if needed.
If you call a plain function from an async function, you know it will not run on a different thread no matter the executor. In this Loom model, you don't know that.
You control the thread until you yield execution no matter the executor. Explicit async methods also means you get explicit sync methods. In that sense, you will not be pre-empted when code changes under you. You can write async tasks that you know will run atomically without locks because you never yielded execution.
In this implicit model, I don't believe that's the case. Because yield points can be added at any time and thus you can be pre-empted at any time, you need to use locks for atomicity (or give up and revert to using a normal Thread). I don't think its possible to interweave this implicit yielding with atomic execution in a way that's as simple as calling a sync function. Is there some other way?