Rudimentary, non-preemptive task system in portable C, based on Tom Duff's switch-based coroutine trick and a stack of environment structs.
More...
|
| const char * | pax_op_to_str (int x) |
| |
| uint32_t | get_my_xcom_id () |
| |
| | init_xdr_array (pollfd) free_xdr_array(pollfd) set_xdr_array(pollfd) get_xdr_array(pollfd) init_xdr_array(task_env_p) free_xdr_array(task_env_p) set_xdr_array(task_env_p) get_xdr_array(task_env_p) struct iotasks |
| |
| static task_env * | extract_first_delayed () |
| |
| static task_env * | task_ref (task_env *t) |
| |
| static task_env * | task_unref (task_env *t) |
| |
| static void | wake_all_io () |
| |
| static void | task_sys_deinit () |
| |
| static double | ts_to_sec (struct timespec *ts) |
| |
| static double | get_monotonic_time () |
| |
| static double | get_real_time () |
| |
| static double | xcom_monotonic_seconds (xcom_clock *clock) |
| |
| static void | xcom_init_clock (xcom_clock *clock) |
| |
| double | seconds () |
| |
| double | task_now () |
| |
| static void | task_queue_siftup (task_queue *q, int n) |
| |
| static void | task_queue_siftdown (task_queue *q, int l, int n) |
| |
| static task_env * | task_queue_remove (task_queue *q, int i) |
| |
| static void | task_queue_insert (task_queue *q, task_env *t) |
| |
| static int | task_queue_empty (task_queue *q) |
| |
| static task_env * | task_queue_min (task_queue *q) |
| |
| static task_env * | task_queue_extractmin (task_queue *q) |
| |
| static void | task_init (task_env *t) |
| | Initialize task memory. More...
|
| |
| void * | task_allocate (task_env *p, unsigned int bytes) |
| | Allocate bytes from pool, initialized to zero. More...
|
| |
| static task_env * | activate (task_env *t) |
| |
| static task_env * | deactivate (task_env *t) |
| |
| void | task_delay_until (double time) |
| |
| void | task_wait (task_env *t, linkage *queue) |
| |
| void | task_wakeup (linkage *queue) |
| |
| static void | task_wakeup_first (linkage *queue) |
| |
| channel * | channel_init (channel *c, unsigned int type) |
| |
| void | channel_put (channel *c, linkage *data) |
| |
| void | channel_put_front (channel *c, linkage *data) |
| |
| task_env * | task_new (task_func func, task_arg arg, const char *name, int debug) |
| |
| void | reset_state (task_env *p) |
| |
| void | pushp (task_env *p, void *ptr) |
| |
| void | popp (task_env *p) |
| |
| static int | runnable_tasks () |
| |
| static int | delayed_tasks () |
| |
| static void | task_delete (task_env *t) |
| |
| task_env * | task_activate (task_env *t) |
| |
| task_env * | task_deactivate (task_env *t) |
| |
| task_env * | task_terminate (task_env *t) |
| |
| void | task_terminate_all () |
| |
| static task_env * | first_delayed () |
| |
| static void | iotasks_init (iotasks *iot_to_init) |
| |
| static void | iotasks_deinit (iotasks *iot_to_deinit) |
| |
| static void | poll_wakeup (u_int i) |
| |
| static int | poll_wait (int ms) |
| |
| static void | add_fd (task_env *t, int fd, int op) |
| |
| static void | unpoll (u_int i) |
| |
| void | remove_and_wakeup (int fd) |
| |
| task_env * | wait_io (task_env *t, int fd, int op) |
| |
| result | con_read (connection_descriptor const *rfd, void *buf, int n) |
| |
| result | con_pipe_read (connection_descriptor const *rfd, void *buf, int n) |
| |
| int | task_read (connection_descriptor const *con, void *buf, int n, int64_t *ret, connnection_read_method read_function) |
| |
| result | con_write (connection_descriptor const *wfd, void *buf, int n) |
| |
| result | con_pipe_write (connection_descriptor const *wfd, void *buf, int n) |
| |
| int | task_write (connection_descriptor const *con, void *_buf, uint32_t n, int64_t *ret) |
| |
| int | unblock_fd (int fd) |
| |
| int | block_fd (int fd) |
| |
| int | is_only_task () |
| |
| static task_env * | first_runnable () |
| |
| static task_env * | next_task (task_env *t) |
| |
| static int | is_task_head (task_env *t) |
| |
| static int | msdiff (double time) |
| |
| void | set_should_exit_getter (should_exit_getter x) |
| |
| void | task_loop () |
| |
| static void | init_task_vars () |
| |
| void | task_sys_init () |
| |
| void | set_task (task_env **p, task_env *t) |
| |
| const char * | task_name () |
| |
Rudimentary, non-preemptive task system in portable C, based on Tom Duff's switch-based coroutine trick and a stack of environment structs.
(continuations?) Nonblocking IO and event handling need to be rewritten for each new OS. The code is not MT-safe, but could be made safe by moving all global variables into a context struct which could be the first parameter to all the functions.