extern void add_to_runqueue(runqueue_t *runq, gt_spinlock_t *runq_lock, uthread_struct_t *u_elem) { gt_spin_lock(runq_lock); runq_lock->holder = 0x02; __add_to_runqueue(runq, u_elem); gt_spin_unlock(runq_lock); return; }
extern void add_to_runqueue(runqueue_t *runq, gt_spinlock_t *runq_lock, pcs_uthread_t *u_elem) { if (runq_lock) { gt_spin_lock(runq_lock); runq_lock->holder = 0x02; } __add_to_runqueue(runq, u_elem); if (runq_lock) gt_spin_unlock(runq_lock); return; }
static void fill_runq(runqueue_t *runq) { uthread_struct_t *u_obj; int inx; /* create and insert */ for(inx=0; inx<MAX_UTHREADS; inx++) { u_obj = &u_objs[inx]; u_obj->uthread_tid = inx; u_obj->uthread_gid = (inx % MAX_UTHREAD_GROUPS); u_obj->uthread_priority = (inx % MAX_UTHREAD_PRIORITY); __add_to_runqueue(runq, u_obj); printf("Uthread (id:%d , prio:%d) inserted\n", u_obj->uthread_tid, u_obj->uthread_priority); } return; }