# HG changeset patch # User game@zeus.cr.ie.u-ryukyu.ac.jp # Date 1274599432 -32400 # Node ID 6e8f8eb1e407702c7409f5788c57f67d4d44e4a6 # Parent e6eea3a208cdfc62d96591b2f28c69dd0668f9ad queueInfoTest 90% done diff -r e6eea3a208cd -r 6e8f8eb1e407 TaskManager/kernel/ppe/QueueInfo.h --- a/TaskManager/kernel/ppe/QueueInfo.h Sun May 23 11:30:39 2010 +0900 +++ b/TaskManager/kernel/ppe/QueueInfo.h Sun May 23 16:23:52 2010 +0900 @@ -2,6 +2,7 @@ #define INCLUDED_QUEUE_INFO #include "base.h" +#include "types.h" #if 0 template class Queue : T { @@ -21,9 +22,13 @@ public: /* constructor */ - QueueInfo(); + QueueInfo(){ + queueInfoInit(); + } QueueInfo(QueueInfo *p) { + queueInfoInit(); queuePool = p; + queuePool->queuePool = queuePool; } BASE_NEW_DELETE(QueueInfo); @@ -59,6 +64,7 @@ /* functions */ int extend_pool(int num); void destroy(); + void queueInfoInit(); }; @@ -73,7 +79,7 @@ // you have to define it at where you want to use. // templatestatic QueueInfo QueueInfo::queuePool; -templateQueueInfo::QueueInfo() { +templatevoid QueueInfo::queueInfoInit() { // 最初の一つは自分 first = last = this; this->next = this->prev = this; @@ -93,20 +99,23 @@ templateint QueueInfo::extend_pool(int num) { - T * q = (T *)malloc(sizeof(T)*(num+1)); + T* q = (T*)malloc(sizeof(T)*(num+1)+DEFAULT_ALIGNMENT); // First Queue is previous pool q->waiter = this->waiter; this->waiter = q; + q = (T*)ROUND_UP_ALIGN((long)q, DEFAULT_ALIGNMENT); q++; /* Connect all free queue in the pool */ - T * p = q; - for (; num-- > 0; p++) { - p->waiter = NULL; - queuePool->addLast(p); + T* p = q; + for (; num-- > 0;) { + p->waiter = NULL; + queuePool->addLast(p); + p = (T*)ROUND_UP_ALIGN((long)(p+1),DEFAULT_ALIGNMENT); } return 0; + } /** diff -r e6eea3a208cd -r 6e8f8eb1e407 example/task_queue/Makefile.def --- a/example/task_queue/Makefile.def Sun May 23 11:30:39 2010 +0900 +++ b/example/task_queue/Makefile.def Sun May 23 16:23:52 2010 +0900 @@ -8,7 +8,7 @@ CERIUM = ../../../Cerium CC = g++ -CFLAGS = -g -Wall -O9 +CFLAGS = -g -Wall #-O9 INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager