//=-------------------------------------------------------------------------=// // Main // // // // Copyright © 2021 The Gem-graph Project // // // // This file is part of gem-graph. // // // // This program is free software: you can redistribute it and/or modify // // it under the terms of the GNU Affero General Public License as // // published by the Free Software Foundation, either version 3 of the // // License, or (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU Affero General Public License for more details. // // // // You should have received a copy of the GNU Affero General Public License // // along with this program. If not, see . // //=-------------------------------------------------------------------------=// #include "../include/base.h" #include "../include/server.h" #include "../include/scheduler.h" #define ARROW_NUMBER 150 #define MAX_CYCLES 15 #define SPACE_SIZE 10000 #define MAX_THREAD 0 int main(int argc, char **argv) { time_t t; Scheduler_t *scheduler0; // Go! printLog("Starting gem-graph-server...\n"); // // random generator // t = time(&t); srand((unsigned) t); // // Creating structure for the Scheduler // scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t)); scheduler0->globalDrawingSpace = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t)); scheduler0->globalDrawingSpace->space = (Arrow_t*) calloc(SPACE_SIZE, sizeof(Arrow_t)); scheduler0->globalDrawingSpace->size = SPACE_SIZE; scheduler0->arrowList = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t)); scheduler0->arrowList->space = (Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t)); scheduler0->arrowList->size = ARROW_NUMBER; printLog("Populating a random arrow list...\n"); for (int i = 0; i < ARROW_NUMBER; i++) { scheduler0->arrowList->space[i].x = rand() % scheduler0->globalDrawingSpace->xmax; scheduler0->arrowList->space[i].y = rand() % scheduler0->globalDrawingSpace->ymax; scheduler0->arrowList->space[i].z = rand() % scheduler0->globalDrawingSpace->zmax; } scheduler0->nmaxThread = MAX_THREAD; scheduler0->nmaxCycles = MAX_CYCLES; // // Creating the Scheduler thread // SchedInit(scheduler0); SchedWait(scheduler0); SchedDestroy(scheduler0); free(scheduler0); return 0; }