view TaskManager/Cell/CellTaskListInfo.cc @ 808:8a6f1fa038de

TaskListInfo version
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 22 May 2010 22:32:41 +0900
parents 8843edf37c0e
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include "CellTaskListInfo.h"

#define NEXT_ADDR(addr, size) \
    (TaskListPtr)((memaddr)(addr) + (size))

int
TaskListInfo::extend_pool(int num)
{
    TaskListPtr q;
    int unit_size;
    
    unit_size = (ROUND_UP_ALIGN(sizeof(TaskList), DEFAULT_ALIGNMENT));
    posix_memalign((void**)&q, DEFAULT_ALIGNMENT, unit_size*(num+1));

    // First Queue is previous pool
    q->waiter = waiter; waiter = q;
    q++;

    /* Connect all free queue in the pool */
    TaskListPtr p = q;
    for (; num-- > 0; p++) {
	p->waiter = NULL;
	taskListPool.addLast(p);
    }

    return 0;
}

/* end */