src/ppe/pk/kernel/pk_thread_core.c
// This routine is only used locally.  Interrupts must be disabled
// at entry.  This routine is only ever called on threads in the
// PK_THREAD_STATE_MAPPED. Unmapping a thread removes it from the priority
// map, the run queue and any semaphore pend, but does not cancel any
// timers. Scheduling must be handled by the code calling
// __pk_thread_unmap().
This routine is only used locally.  Interrupts must be disabled
at entry.  This routine is only ever called on threads in the
PK_THREAD_STATE_MAPPED. Unmapping a thread removes it from the priority
map, the run queue and any semaphore pend, but does not cancel any
timers. Scheduling must be handled by the code calling
pk_thread_unmap().
This routine is only used locally . Interrupts must be disabled at entry . This routine is only ever called on threads in the PK_THREAD_STATE_MAPPED . Unmapping a thread removes it from the priority map the run queue and any semaphore pend but does not cancel any timers . Scheduling must be handled by the code calling pk_thread_unmap () .
void
__pk_thread_unmap(PkThread *thread)
{
    PkThreadPriority priority;
    priority = thread->priority;
    __pk_priority_map[priority] = 0;
    if (__pk_thread_is_runnable(thread)) {
        thread->state = PK_THREAD_STATE_SUSPENDED_RUNNABLE;
        __pk_thread_queue_delete(&__pk_run_queue, priority);
    } else {
        thread->state = PK_THREAD_STATE_SUSPENDED_BLOCKED;
        if (thread->flags & PK_THREAD_FLAG_SEMAPHORE_PEND) {
            __pk_thread_queue_delete(&(thread->semaphore->pending_threads), 
                                      priority);
        }
    }
}
void __pk_thread_unmap ( PkThread * thread ) { PkThreadPriority priority ; priority = thread -> priority ; __pk_priority_map [ priority ] = 0 ; if ( __pk_thread_is_runnable ( thread ) ) { thread -> state = PK_THREAD_STATE_SUSPENDED_RUNNABLE ; __pk_thread_queue_delete ( & __pk_run_queue , priority ) ; } else { thread -> state = PK_THREAD_STATE_SUSPENDED_BLOCKED ; if ( thread -> flags & PK_THREAD_FLAG_SEMAPHORE_PEND ) { __pk_thread_queue_delete ( & ( thread -> semaphore -> pending_threads ) , priority ) ; } } }
This routine is only used locally.
This routine is only used locally .