57 lines
1009 B
C
57 lines
1009 B
C
#ifndef _HIP_PRV_H_
|
|
#define _HIP_PRV_H_
|
|
|
|
#include "hip.h"
|
|
#include <ucontext.h>
|
|
#include <signal.h>
|
|
#include <time.h>
|
|
|
|
#define UCTX_FROM_LINK(_link) HIP_CONTAINEROF(_link, hip_uctx_t, uctx)
|
|
|
|
struct hip_uctx_t
|
|
{
|
|
hip_t* hip;
|
|
/* TODO: add a small name field for debugging and identification */
|
|
ucontext_t uc;
|
|
int flags;
|
|
hip_ufun_t uf;
|
|
void* ctx;
|
|
hip_oow_t csi; /* number of context switches in */
|
|
hip_oow_t cso; /* number of context switches out */
|
|
|
|
hip_nsecdur_t wakeup_time;
|
|
int waiting_fd;
|
|
unsigned int stid;
|
|
|
|
hip_uint8_t* chan_data_ptr;
|
|
hip_oow_t chan_data_len;
|
|
int* chan_ret_ptr;
|
|
|
|
hip_uctx_link_t uctx;
|
|
hip_uctx_link_t io_done;
|
|
};
|
|
|
|
struct hip_t
|
|
{
|
|
int flags;
|
|
|
|
struct sigaction oldsa;
|
|
timer_t tmr_id;
|
|
int mux_id;
|
|
|
|
hip_uctx_link_t runnables;
|
|
hip_uctx_link_t terminated;
|
|
hip_uctx_link_t sleeping;
|
|
hip_uctx_link_t io_waiting;
|
|
hip_uctx_link_t io_done;
|
|
hip_uctx_link_t suspended;
|
|
|
|
hip_uctx_link_t* running;
|
|
|
|
hip_uctx_t* uctx_sched;
|
|
hip_uctx_t* uctx_mux;
|
|
ucontext_t uc_main;
|
|
};
|
|
|
|
#endif
|