view TaskManager/kernel/ppe/TaskManagerImpl.h @ 475:e083c4ff91c1

BufferManager removed.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 04 Oct 2009 11:29:50 +0900
parents eab18aa0c7f6
children 5bda98b0b56d
line wrap: on
line source

#ifndef INCLUDED_TASK_MANAGER_IMPL
#define INCLUDED_TASK_MANAGER_IMPL

#include "MailManager.h"
#include "ListData.h"
#include "Scheduler.h"
#include "TaskListInfo.h"
#include "TaskQueueInfo.h"
#include "HTaskInfo.h"


class TaskManagerImpl {
public:
    /* constructor */
    TaskManagerImpl(int num = 1);
    virtual ~TaskManagerImpl(void) {}

    /* variables */
    int machineNum;
    TaskQueuePtr activeTaskQueue;
    TaskQueuePtr waitTaskQueue;

    /* variables */
    TaskListInfo *taskListImpl;
    TaskQueueInfo *taskQueueImpl;
    HTaskInfo *htaskImpl;

    /* functions */
    // system
    virtual void init(void) = 0;
    virtual void run(void) = 0;
    virtual void append_activeTask(HTaskPtr);
    virtual void append_waitTask(HTaskPtr);

    void check_task_finish(HTaskPtr task);
    void notify_wait_taskQueue(HTaskPtr depend, TaskQueuePtr list);
    TaskQueuePtr remove_taskQueue(TaskQueuePtr list, TaskQueuePtr task);
    TaskQueuePtr remove_taskQueue_eq_task(TaskQueuePtr list, HTaskPtr task);
    void remove_taskQueue_all(TaskQueuePtr list);
    void wakeup_waitTask(void);

    void systask_init(void);

    // user
    HTaskPtr create_task(int cmd);
    void set_task_depend(HTaskPtr master, HTaskPtr slave);
    void spawn_task(HTaskPtr);
    void set_task_cpu(HTaskPtr, CPU_TYPE);
    virtual void* allocate(int size) = 0;
    virtual Scheduler* get_scheduler() = 0;
};
#endif