Libtask is a simple coroutine library. It runs on Linux (ARM and x86), FreeBSD (x86), OS X (PowerPC x86, and x86-64), and SunOS Solaris (Sparc), and is easy to port to other systems.
Libtask gives the programmer the illusion of threads, but the operating system sees only a single kernel thread. For clarity, we refer to the coroutines as "tasks," not threads.
Scheduling is cooperative. Only one task runs at a time, and it cannot be rescheduled without explicitly giving up the CPU. Most of the functions provided in task.h do have the possibility of going to sleep. Programs using the task functions should #include .
= Basic task manipulation
int taskcreate(void (*f)(void *arg), void *arg, unsigned int stacksize);
Create a new task running f(arg) on a stack of size stacksize.