comparison TaskManager/Cell/CellTaskListInfo.cc @ 60:f50c74835a9b

*** empty log message ***
author gongo
date Sat, 16 Feb 2008 20:05:35 +0900
parents 1f8a23cdeec3
children 5c194c71eca8
comparison
equal deleted inserted replaced
59:16f9f6251f49 60:f50c74835a9b
1 #include <stdio.h> 1 #include <stdio.h>
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include "CellTaskListInfo.h" 3 #include "CellTaskListInfo.h"
4 4
5 #define NEXT_ADDR(addr, size) \
6 (TaskListPtr)((int)(addr) + (size))
7
5 int 8 int
6 CellTaskListInfo::extend_pool(int num) 9 CellTaskListInfo::extend_pool(int num)
7 { 10 {
8 TaskListPtr q = NULL, p; 11 TaskListPtr q = NULL;
9 int unit_size; 12 int unit_size;
10 13
11 unit_size = (ROUND_UP_ALIGN(sizeof(TaskList), 16)); 14 unit_size = (ROUND_UP_ALIGN(sizeof(TaskList), 16));
12 posix_memalign((void**)&q, 16, unit_size*(num+1)); 15 posix_memalign((void**)&q, 16, unit_size*(num+1));
13 16
17 20
18 q->next = taskListPool; 21 q->next = taskListPool;
19 taskListPool = q; 22 taskListPool = q;
20 23
21 /* Connect all free pack_list in the pool */ 24 /* Connect all free pack_list in the pool */
22 q = NEXT_ADDR(taskListPool,unit_size); // q = taskListPool + 1; 25 q = NEXT_ADDR(taskListPool, unit_size); // q = taskListPool + 1;
23 for (; --num > 0; q = NEXT_ADDR(q + unit_size)) { 26 for (; --num > 0; q = NEXT_ADDR(q, unit_size)) {
24 q->naext = NEXT_ADDR(q, unit_size); // q->next = q + 1; 27 q->next = NEXT_ADDR(q, unit_size); // q->next = q + 1;
25 } 28 }
26 q->next = freeTaskList; 29 q->next = freeTaskList;
27 freeTaskList = NEXT_ADDR(taskListPool, unit_size); 30 freeTaskList = NEXT_ADDR(taskListPool, unit_size);
28 31
29 return 0; 32 return 0;