5 ms·
> Well, if I am being honest, there is a bit of up-front knowledge here. I don’t think we can avoid spawning real threads here, unless we do something really cu
by ahepp 2y ago
> Well, if I am being honest, there is a bit of up-front knowledge here. I don’t think we can avoid spawning real threads here, unless we do something really cursed with inline assembly. When something calls that pause() function, and we want it to stay paused until further notice, that just has to happen in a thread which maintains a stack separate from the stack of our test.
Is there a reason we couldn't use some kind of async runtime? It seems like you're instrumenting atomic operations to achieve cooperative multitasking. Maybe I need to drink more coffee, but it seems simpler without threads.
- claytonwramsey 2y agoIt would be convenient to use async, but the other requirement is that we don’t want to change the outwardly-observable API of the software under test. Since async is “infectious,” we have to use sync implementations for sync APIs.
- oasisaimlessly 2y agoWhat about stackful coroutines? They don't necessarily change the API.
- zbentley 2y agoWhy does stackfulness not color functions? So long as preemption/parallelism boundaries are manually annotated, I don’t think stackful coroutines save you anything here.
- anonymoushn 2y agoJust don't annotate them? The design of async is a wound that can be bandaged by dumping all your registers on the stack and jumping.
- LegNeato 2y agoCheck out https://github.com/jonnadal/fibril https://github.com/jonnadal/fibril