コード例 #1
0
ファイル: server.cpp プロジェクト: glipari/rtlib
    void Server::onDispatch(Event *e)
    {
        DBGENTER(_SERVER_DBG_LEV);

        AbsRTTask *newExe = sched_->getFirst();

        DBGPRINT("Current situation");
        DBGPRINT_2("newExe: ", taskname(newExe));
        DBGPRINT_2("currExe_: ", taskname(currExe_));
        
        if (newExe != currExe_) {
            if (currExe_ != NULL) currExe_->deschedule();
            currExe_ = newExe;
            if (newExe != NULL) newExe->schedule();
            //sched_->notify(newExe);
        }

        DBGPRINT_2("Now Running: ", taskname(newExe));

        if (currExe_ == NULL) {
            sched_->notify(NULL);
            executing_releasing();
            kernel->suspend(this);
            kernel->dispatch();
        }
    }
コード例 #2
0
ファイル: mrtkernel.cpp プロジェクト: ReTiS-Lab/RTLIB
    void MRTKernel::onEndDispatchMulti(EndDispatchMultiEvt* e)
    {
        // performs the "real" context switch
        DBGENTER(_KERNEL_DBG_LEV);

        AbsRTTask *st = e->getTask();
        CPU *p = e->getCPU();

        _m_currExe[p] = st;

        DBGPRINT_2("CPU: ", p);
        DBGPRINT_2("Task: ", taskname(st));
        
        // st could be null (because of an idling processor)
        if (st) st->schedule();

	_isContextSwitching[p] = false;
        _sched->notify(st);
    }