示例#1
0
/** Wake up all the threads in a wait queue
    @param[in] wq  wait queue
    @param[in] reason wakeup reason
 */
void 
wque_wakeup(wait_queue *wq, wq_reason reason) {
	psw_t              psw;
	wait_queue_entry   *ep;

	psw_disable_and_save_interrupt(&psw);
	if ( list_is_empty(&wq->head) )
		goto out;

	while(!list_is_empty(&wq->head)) {
		ep = CONTAINER_OF(list_get_top(&wq->head), wait_queue_entry, link);

		list_del(&ep->link);
		init_list_node(&ep->link);
		ep->thr->status = THR_TSTATE_RUN;
		sched_set_ready(ep->thr); 
		ep->thr = NULL;
	}
	wq->reason = reason;
	sched_schedule();    /*  Reschedule because change the top priority task */
out:
	psw_restore_interrupt(&psw);
}
示例#2
0
void Threads::resume(int suspID){
	sched_set_ready(pop_in_waiting_queue(suspID));
}