Mercurial > hg > Game > Cerium
comparison TaskManager/kernel/ppe/TaskManagerImpl.cc @ 3:2356238ebea7
*** empty log message ***
author | gongo |
---|---|
date | Tue, 05 Feb 2008 20:22:50 +0900 (2008-02-05) |
parents | |
children | 75f184d16fa5 |
comparison
equal
deleted
inserted
replaced
2:70e9baa00f51 | 3:2356238ebea7 |
---|---|
1 #include "TaskManagerImpl.h" | |
2 | |
3 void | |
4 noaction(void) | |
5 { | |
6 } | |
7 | |
8 TaskManagerImpl::TaskManagerImpl(int num) | |
9 { | |
10 machineNum = num; | |
11 } | |
12 | |
13 HTaskPtr | |
14 TaskManagerImpl::create_task(int cmd, int size, | |
15 unsigned long long in_addr, | |
16 unsigned long long out_addr, | |
17 void (*func)(void)) | |
18 { | |
19 HTaskPtr new_task; | |
20 | |
21 new_task = taskInfo->get_free_task(cmd, size, in_addr, out_addr); | |
22 | |
23 if (func == NULL) { | |
24 new_task->post_func = noaction; | |
25 } else { | |
26 new_task->post_func = func; | |
27 } | |
28 | |
29 return new_task; | |
30 } | |
31 | |
32 /** | |
33 * task �ΰ�¸�ط������� | |
34 * master task ������äƤ��顢slave task ��¹Ԥ���褦�� | |
35 */ | |
36 void | |
37 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) | |
38 { | |
39 TaskQueuePtr m, s; | |
40 | |
41 m = taskInfo->get_free_taskQueue(master); | |
42 s = taskInfo->get_free_taskQueue(slave); | |
43 | |
44 master->wait_me = append_taskQueue(master->wait_me, s); | |
45 slave->wait_i = append_taskQueue(slave->wait_i, m); | |
46 } | |
47 | |
48 void | |
49 TaskManagerImpl::run_task(HTaskPtr task) | |
50 { | |
51 if (task->wait_i == NULL) { | |
52 taskInfo->append_activeTask(task); | |
53 } else { | |
54 taskInfo->append_waitTask(task); | |
55 } | |
56 } |