view TaskManager/Cell/spe/SchedNop2Ready.cc @ 109:5c194c71eca8

Cerium cvs version
author gongo@gendarme.local
date Wed, 12 Nov 2008 17:39:33 +0900
parents 588ab5f0e659
children 907bda4a1a14
line wrap: on
line source

#include <stdio.h>
#include "SchedNop2Ready.h"
#include "SchedTaskList.h"
#include "SchedMail.h"
#include "error.h"

SchedNop2Ready::SchedNop2Ready(Scheduler *cn)
{
    scheduler = cn;
}

void
SchedNop2Ready::exec(void)
{
    __debug("[SchedNop2Ready:%s]\n", __FUNCTION__);

    //scheduler->mail_write(MY_SPE_STATUS_READY);
}

SchedTaskBase*
SchedNop2Ready::next(Scheduler *m, SchedTaskBase *p)
{
    __debug("[SchedNop2Ready:%s]\n", __FUNCTION__);
    
    delete p;

    // 追加されたタスクがあれば
    if (scheduler->renewTop_taskList) {
	TaskListPtr list = scheduler->renewTop_taskList;
	scheduler->renewTop_taskList = scheduler->renewTop_taskList->next;
	scheduler->renewCur_taskList = NULL;

	list->next = NULL;
	SchedTaskList *schd = new SchedTaskList((unsigned int)list, scheduler);
	schd->flag_renewTaskList = 1;
	return schd;
    } else {
	scheduler->mail_write(MY_SPE_STATUS_READY);
	return new SchedMail(scheduler);
    }
}