/* * If the thread's sleep is cancellable, we set the kt_cancelled * flag and remove it from the queue. Otherwise, we just set the * kt_cancelled flag and leave the thread on the queue. * * Remember, unless the thread is in the KT_NO_STATE or KT_EXITED * state, it should be on some queue. Otherwise, it will never be run * again. */ void sched_cancel(struct kthread *kthr) { //NOT_YET_IMPLEMENTED("PROCS: sched_cancel"); kthr->kt_cancelled = 1; if (kthr->kt_state == KT_SLEEP_CANCELLABLE) { ktqueue_remove(kthr->kt_wchan, kthr); sched_make_runnable(kthr); } }
/* * If the thread's sleep is cancellable, we set the kt_cancelled * flag and remove it from the queue. Otherwise, we just set the * kt_cancelled flag and leave the thread on the queue. * * Remember, unless the thread is in the KT_NO_STATE or KT_EXITED * state, it should be on some queue. Otherwise, it will never be run * again. */ void sched_cancel(struct kthread *kthr) { if(kthr->kt_state == KT_SLEEP_CANCELLABLE) { kthr->kt_cancelled = 1; kthr->kt_state = KT_RUN; ktqueue_t *q = kthr->kt_wchan; ktqueue_remove(q,kthr); ktqueue_enqueue(&kt_runq,kthr); } }
/* * If the thread's sleep is cancellable, we set the kt_cancelled * flag and remove it from the queue. Otherwise, we just set the * kt_cancelled flag and leave the thread on the queue. * * Remember, unless the thread is in the KT_NO_STATE or KT_EXITED * state, it should be on some queue. Otherwise, it will never be run * again. */ void sched_cancel(struct kthread *kthr) { kthr->kt_cancelled = 1; /* If cancellable sleep, wake from queue it's waiting on */ if (kthr->kt_state == KT_SLEEP_CANCELLABLE) { ktqueue_remove(kthr->kt_wchan, kthr); kthr->kt_wchan = NULL; sched_make_runnable(kthr); } /* NOT_YET_IMPLEMENTED("PROCS: sched_cancel"); */ }
/* * If the thread's sleep is cancellable, we set the kt_cancelled * flag and remove it from the queue. Otherwise, we just set the * kt_cancelled flag and leave the thread on the queue. * * Remember, unless the thread is in the KT_NO_STATE or KT_EXITED * state, it should be on some queue. Otherwise, it will never be run * again. */ void sched_cancel(struct kthread *kthr) { kthr->kt_cancelled = 1; if (kthr->kt_state == KT_SLEEP_CANCELLABLE) { ktqueue_remove(kthr->kt_wchan, kthr); sched_make_runnable(kthr); } /* else if (kthr->kt_state == KT_RUN) { ktqueue_dequeue(kthr->kt_wchan); }*/ }
/* * If the thread's sleep is cancellable, we set the kt_cancelled * flag and remove it from the queue. Otherwise, we just set the * kt_cancelled flag and leave the thread on the queue. * * Remember, unless the thread is in the KT_NO_STATE or KT_EXITED * state, it should be on some queue. Otherwise, it will never be run * again. */ void sched_cancel(struct kthread *kthr) { /*----Kernel1:PROCS:sched_cancel:Begins---*/ if(kthr->kt_state == KT_SLEEP_CANCELLABLE) { kthr->kt_cancelled=1; ktqueue_remove(kthr->kt_wchan, kthr); sched_make_runnable(kthr); } else { kthr->kt_cancelled=1; } /*----Ends---*/ }