Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/CellTaskListInfo.cc @ 805:daab9cd6f91f
merge
author | yutaka@localhost.localdomain |
---|---|
date | Fri, 21 May 2010 18:31:31 +0900 |
parents | 8843edf37c0e |
children | 8a6f1fa038de |
rev | line source |
---|---|
57 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include "CellTaskListInfo.h" | |
4 | |
60 | 5 #define NEXT_ADDR(addr, size) \ |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
109
diff
changeset
|
6 (TaskListPtr)((memaddr)(addr) + (size)) |
60 | 7 |
57 | 8 int |
9 CellTaskListInfo::extend_pool(int num) | |
10 { | |
60 | 11 TaskListPtr q = NULL; |
57 | 12 int unit_size; |
13 | |
109 | 14 unit_size = (ROUND_UP_ALIGN(sizeof(TaskList), DEFAULT_ALIGNMENT)); |
15 posix_memalign((void**)&q, DEFAULT_ALIGNMENT, unit_size*(num+1)); | |
57 | 16 |
17 if (q == NULL) { | |
18 return -1; | |
19 } | |
20 | |
21 q->next = taskListPool; | |
22 taskListPool = q; | |
23 | |
24 /* Connect all free pack_list in the pool */ | |
60 | 25 q = NEXT_ADDR(taskListPool, unit_size); // q = taskListPool + 1; |
26 for (; --num > 0; q = NEXT_ADDR(q, unit_size)) { | |
27 q->next = NEXT_ADDR(q, unit_size); // q->next = q + 1; | |
57 | 28 } |
29 q->next = freeTaskList; | |
30 freeTaskList = NEXT_ADDR(taskListPool, unit_size); | |
31 | |
32 return 0; | |
33 } |