view paper/src/metaCreateTask.cbc @ 19:046b2b20d6c7 default tip

fix
author ryokka
date Mon, 09 Mar 2020 11:25:49 +0900
parents c7acb9211784
children
line wrap: on
line source

__code code1(struct Context *context, Integer *integer1, Integer *integer2, Integer *output) {
    // create context
    context->task = NEW(struct Context);
    initContext(context->task);

    // set task parameter
    context->task->next = C_add;
    context->task->idgCount = 2;
    context->task->idg = context->task->dataNum;
    context->task->maxIdg = context->task->idg + 2;
    context->task->odg = context->task->maxIdg;
    context->task->maxOdg = context->task->odg + 1;

    // create Data Gear Queue
    GET_META(integer1)->wait = createSynchronizedQueue(context);
    GET_META(integer2)->wait = createSynchronizedQueue(context);
    GET_META(integer3)->wait = createSynchronizedQueue(context);

    // set Input Data Gear
    context->task->data[context->task->idg+0] = (union Data*)integer1;
    context->task->data[context->task->idg+1] = (union Data*)integer2;

    // set Output Data Gear
    context->task->data[context->task->odg+0] = (union Data*)integer3;

    // add taskList Element
    struct Element* element;
    element = &ALLOCATE(context, Element)->Element;
    element->data = (union Data*)context->task;
    element->next = context->taskList;
    context->taskList = element;
    
    // set TaskManager->spawns parameter
    Gearef(context, TaskManager)->taskList = context->taskList;
    Gearef(context, TaskManager)->next1 = C_code2;
    goto meta(context, C_code2);
}

// code gear
__code add(Integer *integer1, Integer *integer2, next(Integer *output, ...)) {
	....
}