|
|
|
|
|
by enqk
4680 days ago
|
|
Care to explain further? In my experience of using protothreads, only the functions using the protothread macros need to be written in a special way: - passing a context object
- being careful of variable initialization/blocks
in order not to work on unitialized memory.
while all the other ones can stay plain C functions. |
|
Why would functions called by "lightweight threads"/"coroutines"/whatever want to yield? One example is, they want to wait for an event - an I/O request completion or a computation offloaded to an accelerator or whatever - without having to return all the way back to the event loop.