view TaskManager/Cell/CellTaskListInfo.cc @ 57:1f8a23cdeec3

*** empty log message ***
author gongo
date Sat, 16 Feb 2008 19:40:20 +0900
parents
children f50c74835a9b
line wrap: on
line source

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

int
CellTaskListInfo::extend_pool(int num)
{
    TaskListPtr q = NULL, p;
    int unit_size;
    
    unit_size = (ROUND_UP_ALIGN(sizeof(TaskList), 16));
    posix_memalign((void**)&q, 16, unit_size*(num+1));

    if (q == NULL) {
        return -1;
    }
    
    q->next = taskListPool;
    taskListPool = q;
    
    /* Connect all free pack_list in the pool */
    q = NEXT_ADDR(taskListPool,unit_size); // q = taskListPool + 1;
    for (; --num > 0; q = NEXT_ADDR(q + unit_size)) {
        q->naext = NEXT_ADDR(q, unit_size); // q->next = q + 1;
    }
    q->next = freeTaskList;
    freeTaskList = NEXT_ADDR(taskListPool, unit_size);

    return 0;
}