Mercurial > hg > Game > Cerium
diff TaskManager/kernel/memory/MemList.h @ 370:4748fd7dcd89 draft
change TaskManger & memory/* & Random
author | aaa |
---|---|
date | Wed, 29 Jul 2009 15:09:36 +0900 |
parents | 93b33cecba37 |
children | 205e4a4af635 |
line wrap: on
line diff
--- a/TaskManager/kernel/memory/MemList.h Tue Jul 28 19:42:59 2009 +0900 +++ b/TaskManager/kernel/memory/MemList.h Wed Jul 29 15:09:36 2009 +0900 @@ -1,19 +1,25 @@ #ifndef MEMLIST #define MEMLIST +#include <stdlib.h> #include "MemorySegment.h" -class MemList { +class MemList : MemorySegment { public: + MemorySegment* pool; MemorySegment* first; MemorySegment* last; // TaskManager 側で create する //MemList* createMemList(uint32 size, uint32 count); MemList(MemorySegment* ms) { - first = last = ms; - ms->next = ms; - ms->prev = ms; + first = last = this; + next = prev = this; + pool = ms; + } + + ~MemList() { + free(pool); } void addFirst(MemorySegment* e); @@ -21,7 +27,9 @@ MemorySegment* getFirst(); MemorySegment* getLast(); int remove(MemorySegment* e); + MemorySegment* poll(); void moveToFirst(MemorySegment* e); // or use(); + MemorySegment* get(int index); }; #endif