void mthr_yield(void);
If there are threads on the runqueue, i.e. threads that had already been running, one of these threads will be taken. If the runqueue is empty, a newly created, but still not started thread will be taken. Be aware of this fact, as it could leed to unexpected behaviour! In the example below only two (!) threads will ever get started per processor and not all threads as might be expected:
#include <mthread.h> void *yield_loop(void *arg) { while(1) { printf("Thread %d will yield the processor\n",(int)arg); mthr_yield(); } } void main() { mthr_startup(); for(i==;i<100;i++) mthr_create(0,DETACHED,CPU_LOCAL,yield_loop,(void *)i); mthr_exit(0); }