3 ms·
coroutine is an old concept before threading became popular. It was usually implemented as a green-thread library. For C, setjmp/longjmp was used to implement
by ww520 14y ago
coroutine is an old concept before threading became popular. It was usually implemented as a green-thread library. For C, setjmp/longjmp was used to implement it. Some libraries messed around with the stack register to implement it.
GO puts it as a first class citizen in the language. Other languages might call it Actor, light weight thread, fiber, task, etc. It's popular in embedded systems to implement cooperative threading using coroutine due to its simplicity and low overhead in resource utilization.
- j2labs 14y agoA coroutine is not the same as an Actor, though actors can be implemented with coroutines.