Product SiteDocumentation Site

Name

tc_sleep, tc_sched_yield — sleep functions

Synopsis

#include <tc/threaded_cr.h>

enum tc_rv tc_sleep(int clockid, time_t sec, long nsec);

void tc_sched_yield();

Description

tc_sleep() sleeps for sec seconds and nsec nano seconds. Clockid might be one of CLOCK_REALTIME or CLOCK_MONOTONIC. CLOCK_REALTIME can be set with the appropriate privileges, CLOCK_MONOTONIC is a strictly monotonic time since some unspecified starting point. It can not be set.
The tc_sched_yield() places the current tc_thread at the end of the queue, and runs the queue. Potentially this gives other tc_threads a chance to run.
This function is provided for sake of completeness. The use of this function is usually not required, since libtcr is designed to work with multiple system level worker threads.

Author

Philipp Reisner