[mkc2007] thread halt/resume

Benjamin Engel be020578 at inf.tu-dresden.de
Thu May 10 08:44:18 CEST 2007


> Its hard to tell what's wrong without looking at the code.
Thread::sys_halt()
{
        Mword dst_low, dst_high;
        Sys_halt_frame *regs = sys_frame_cast<Sys_halt_frame>(this->regs());
        dst_low = regs->dst_low();
        dst_high = regs->dst_high();
        L4_uid dst = L4_uid( ((Unsigned64)dst_high) << 32 | dst_low );
        L4_uid src = current_thread()->id();
        printf("sys_halt() : thread %u.%u wants to halt thread
%u.%u\n",src.task(),src.lthread(),dst.task(),dst.lthread());

        Thread *dst_thread = lookup( dst, space() );
        if( !dst_thread ) {
                return;
        }
        dst_thread->halt_myself();
        // if halting this thread, reschedule
        if( dst == src ) {
                cpu_lock.lock();
                schedule();
                cpu_lock.clear();
        }
}

Thread::halt_myself()
{
        state_del( Thread_ready );
        ready_dequeue();
}


> First you don't need to look up yourself because you are running in your
> own thread context.
Thread::sys_halt() should halt a specific thread, not necessarily itself.
Maybe its fun to halt the pager.




More information about the mkc2007 mailing list