Use sched_yield(3RT) to cause the current thread to yield its execution in favor of another thread with the same or greater priority. If no such threads are ready to run, the calling thread continues to run. The sched_yield() function is not part of the Pthread API, but is a function in the Realtime Library Functions. You must include <sched.h> to use sched_yield().
#include <sched.h> int ret; ret = sched_yield();