Mercurial > hg > Members > kono > Cerium
view TaskManager/kernel/ppe/TaskManagerImpl.h @ 638:671fca057ad3
hmmmm
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Nov 2009 18:18:20 +0900 |
parents | 5530fa36d42e |
children | 7c9ded1ea750 |
line wrap: on
line source
#ifndef INCLUDED_TASK_MANAGER_IMPL #define INCLUDED_TASK_MANAGER_IMPL #include "MailManager.h" #include "ListData.h" #include "TaskListInfo.h" #include "TaskQueueInfo.h" #include "HTaskInfo.h" class Scheduler; class MemList; class TaskManagerImpl { public: /* variables */ int machineNum; HTaskInfo *activeTaskQueue; HTaskInfo *waitTaskQueue; TaskListInfo *taskListImpl; TaskQueueInfo *taskQueueImpl; HTaskInfo *htaskImpl; SchedTask *schedTaskManager; Scheduler *scheduler; /* constructor */ TaskManagerImpl(int num = 1) ; virtual ~TaskManagerImpl() { } /* functions */ // system virtual void init() = 0; virtual void run() = 0; virtual void append_activeTask(HTaskPtr); virtual void append_waitTask(HTaskPtr); void check_task_finish(HTaskPtr task); void wakeup_waitTask(); void systask_init(); // user virtual HTaskPtr create_task(int cmd); virtual HTaskPtr create_task(int cmd, memaddr rbuf, long r_size, memaddr wbuf, long w_size); virtual void set_task_depend(HTaskPtr master, HTaskPtr slave); virtual void spawn_task(HTaskPtr); virtual void set_task_cpu(HTaskPtr, CPU_TYPE); void* allocate(int size, int alignment) { if (size==0) return 0; #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN) return malloc(size); #else void *buff; posix_memalign(&buff, alignment, size); return buff; #endif } void* allocate(int size) { if (size==0) return 0; #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN) return malloc(size); #else void *buff; posix_memalign(&buff, DEFAULT_ALIGNMENT, size); return buff; #endif } Scheduler* get_scheduler() { return scheduler; } void set_scheduler(Scheduler *s) { scheduler = s; } }; #endif