57
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include <string.h>
|
|
4 #include "CellTaskManagerImpl.h"
|
61
|
5 #include "CellBufferManager.h"
|
57
|
6 #include "types.h"
|
65
|
7 #include "error.h"
|
57
|
8
|
|
9 void
|
|
10 CellTaskManagerImpl::init(void)
|
|
11 {
|
|
12 TaskManagerImpl::init();
|
|
13
|
60
|
14 bufferManager = new CellBufferManager();
|
57
|
15 bufferManager->init();
|
65
|
16
|
|
17 speThreads = new SpeThreads(machineNum);
|
|
18 speThreads->init();
|
57
|
19 }
|
|
20
|
65
|
21 /**
|
|
22 * mail_list は ppe 側の mail なので、変更せず渡す。
|
|
23 * その前に spe からのメールをチェックする
|
|
24 */
|
|
25 MailQueuePtr
|
|
26 CellTaskManagerImpl::mail_check(MailQueuePtr mail_list)
|
57
|
27 {
|
65
|
28 int id;
|
|
29 int data;
|
|
30
|
|
31 for (id = 0; id < machineNum; id++) {
|
|
32 while (1) {
|
|
33 data = speThreads->get_mail(id);
|
|
34 if (data < 0) break;
|
|
35
|
|
36 // 名前あとでちゃんと決めよう => MY_SPE_... とかじゃなくて
|
|
37 if (data == MY_SPE_STATUS_READY) {
|
|
38 __debug_ppe("[SPE %d] finish\n", id);
|
|
39 } else {
|
|
40 __debug_ppe("[PPE] recv from [SPE %d] : 0x%x\n", data, id);
|
|
41 bufferManager->check_task_finish((HTaskPtr)data);
|
|
42 }
|
|
43 }
|
|
44 }
|
|
45 return TaskManagerImpl::mail_check(mail_list);
|
57
|
46 }
|
|
47
|
65
|
48
|
57
|
49 TaskManagerImpl*
|
|
50 create_impl(int num)
|
|
51 {
|
|
52 return new CellTaskManagerImpl();
|
|
53 }
|