comparison TaskManager/Fifo/FifoTaskInfo.cc @ 6:39ce245235d4

*** empty log message ***
author gongo
date Wed, 06 Feb 2008 11:41:08 +0900
parents 75f184d16fa5
children 7aa4c006e4be
comparison
equal deleted inserted replaced
5:75f184d16fa5 6:39ce245235d4
3 #include "FifoTaskInfo.h" 3 #include "FifoTaskInfo.h"
4 4
5 void 5 void
6 FifoTaskInfo::init(void) 6 FifoTaskInfo::init(void)
7 { 7 {
8 init_pool_taskQueue(TASK_MAX_SIZE*4); 8 taskListPool = NULL;
9 init_pool_task(TASK_MAX_SIZE); 9 freeTaskList = NULL;
10 init_pool_taskList(2); 10
11 taskQueuePool = NULL;
12 freeTaskQueue = NULL;
13 activeTaskQueue = NULL;
14 waitTaskQueue = NULL;
15
16 taskPool = NULL;
17 freeTask = NULL;
18
19 init_taskList(2);
20 init_taskQueue(TASK_MAX_SIZE*4);
21 init_task(TASK_MAX_SIZE);
11 22
12 machineTaskList = get_free_taskList(); 23 machineTaskList = get_free_taskList();
13 } 24 }
14 25
15 int 26 int
16 FifoTaskInfo::extend_pool_taskList(int num) 27 FifoTaskInfo::extend_pool_taskList(int num)
17 { 28 {
18 TaskListPtr q; 29 TaskListPtr q = NULL;
19 30
20 q = (TaskListPtr)malloc(sizeof(TaskList)*(num+1)); 31 q = (TaskListPtr)malloc(sizeof(TaskList)*(num+1));
21 32
22 if (q == NULL) { 33 if (q == NULL) {
23 return -1; 34 return -1;
25 36
26 q->next = taskListPool; 37 q->next = taskListPool;
27 taskListPool = q; 38 taskListPool = q;
28 39
29 /* Connect all free pack_list in the pool */ 40 /* Connect all free pack_list in the pool */
30 q = taskListPool + 1; 41 for (q = taskListPool + 1; --num > 0; q++) {
31 for (q = taskListPool + 1; num-- > 0; q++) {
32 q->next = q + 1; 42 q->next = q + 1;
33 } 43 }
34 q->next = freeTaskList; 44 q->next = freeTaskList;
35 freeTaskList = taskListPool + 1; 45 freeTaskList = taskListPool + 1;
36 46