Mercurial > hg > Members > kono > Cerium
changeset 962:9f9b2bbc9a10
QueueInfo fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 05 Aug 2010 08:48:57 +0900 |
parents | 02f1a707ee82 |
children | 86e50572561c |
files | TaskManager/kernel/ppe/QueueInfo.h example/task_queue/main.cc |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/QueueInfo.h Wed Aug 04 23:05:59 2010 +0900 +++ b/TaskManager/kernel/ppe/QueueInfo.h Thu Aug 05 08:48:57 2010 +0900 @@ -27,12 +27,11 @@ /* constructor */ /** - singleton constructor - use this in non initialize envrionment is wrong. + singleton queuePool constructor + Do not use this as a Queue */ QueueInfo<T>(){ queueInfoInit(); - queuePool = this; } /** normal constructor requires @@ -89,7 +88,7 @@ /** - singleton constructor + Use singleton queuePool constructor all queueInfo should share this as a pool. exteren QueueInfo<H> pool; @@ -123,6 +122,10 @@ template<typename T>int QueueInfo<T>::extend_pool(int num) { +#ifdef CHECK + if (queuePool) fprintf(stderr, "don't use queuePool directly"); +#endif + T* q = (T*)malloc(sizeof(T)*(num+1)+DEFAULT_ALIGNMENT); // First Queue is previous pool @@ -135,7 +138,7 @@ for (; num-- > 0;) { p->waiter = NULL; p->initOnce(); - queuePool->addLast(p); + addLast(p); p = (T*)ROUND_UP_ALIGN((long)(p+1),DEFAULT_ALIGNMENT); }
--- a/example/task_queue/main.cc Wed Aug 04 23:05:59 2010 +0900 +++ b/example/task_queue/main.cc Thu Aug 05 08:48:57 2010 +0900 @@ -64,7 +64,7 @@ queues.i = 0; for (int i = 0; i < MAX_QUEUE; i++) { QueueInfo<TaskQueue> *q = new QueueInfo<TaskQueue>(mainPool) ; - // QueueInfo<TaskQueue> *q = new QueueInfo<TaskQueue>() ; + // QueueInfo<TaskQueue> *q = new QueueInfo<TaskQueue>() ; // wrong queues.q[i] = q; }