Mercurial > hg > Members > kono > Cerium
diff TaskManager/kernel/ppe/TaskQueueInfo.cc @ 480:46464727d825
TaskQueueInfo initiaization...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 05 Oct 2009 12:24:07 +0900 |
parents | 5bda98b0b56d |
children | 4896dffad67c |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/TaskQueueInfo.cc Mon Oct 05 10:36:37 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskQueueInfo.cc Mon Oct 05 12:24:07 2009 +0900 @@ -2,8 +2,10 @@ #include <stdlib.h> #include "TaskQueueInfo.h" -TaskQueueInfo::TaskQueueInfo(void) - :taskQueuePool(NULL), freeTaskQueue(NULL) {} +TaskQueueInfo::TaskQueueInfo() + :taskQueuePool(NULL), freeTaskQueue(NULL) { + init(32); +} TaskQueueInfo::~TaskQueueInfo(void) { destroy(); } @@ -11,9 +13,10 @@ TaskQueueInfo::init(int num) { if (taskQueuePool == NULL) { - return extend_pool(num); + extend_pool(num); } // 最初の一つは自分 + first = last = this; next = prev = this; return 0; } @@ -26,7 +29,7 @@ q = (TaskQueuePtr)malloc(sizeof(TaskQueue)*(num+1)); if (q == NULL) { - return -1; + return -1; // throw... } q->next = taskQueuePool; taskQueuePool = q; @@ -47,7 +50,7 @@ TaskQueuePtr q; if (freeTaskQueue == NULL) { - extend_pool(100); + extend_pool(64); } q = freeTaskQueue; freeTaskQueue = freeTaskQueue->next; @@ -120,12 +123,14 @@ TaskQueue* TaskQueueInfo::getFirst() { + if (empty()) return NULL; return first->next; } TaskQueue* TaskQueueInfo::getLast() { + if (empty()) return NULL; return last; }