#include #include #include #include #include #define N 10 #define FREE 0 #define INIT 1 #define STACKSIZE (10000) typedef struct state_block{ int state; void (*function)(int); int function_arg; ucontext_t run_env; ucontext_t rtn_env; stack_t mystk; }STATE_BLOCK; STATE_BLOCK t_state[N]; int enter_flag = 0; char interrupt_string2[] = "\tinterrupt on context \n"; char interrupt_string1[] = "\tcall in from context \n"; int current = 0; sigset_t maskval; int bx[10]; void fun1(int), fun2(int), fun3(int), clock_isr(int); int t_init(void (*)(), int); int main(int argc, char *argv[]) { int i,j,k; struct itimerval quantum; struct sigaction sigdat; for(i=0; i