Sup fuckers, I am pleased to annouce the initial release of https://gitea.alexisvl.rocks/alexisvl/utask! utask is an extremely lightweight cooperative multitasking library.

setjmp multitasking

Cooperative multitasking using setjmp and longjmp has been around for ages. For example, see this blogpost:

This does work, but there are a couple things I don't like about it. First, it's as heavy as a traditional preemptive task switch. Every time you switch, a full context is saved and restored. That can be quite a lot of registers on a modern RISC system. Sometimes it's nice to be able to move in and out of tasks rapidly. Second, setjmp and longjmp are sort of crusty and old. They often aren't done very well. For instance,

Last modified: Sun Feb 5 19:57:42 MST 2023. Converted from blog/20230205-utask.md.
RSS feedBlogHomeUpIndex