Model_t + lisibility
This commit is contained in:
parent
cd9285e898
commit
29e43c2f18
|
@ -51,19 +51,19 @@ struct {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *label;
|
char *label;
|
||||||
int narrow;
|
int nArrow;
|
||||||
} typedef Site_t;
|
} typedef Site_t;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int nsite;
|
int nSite;
|
||||||
char *label;
|
char *label;
|
||||||
Site_t *sites;
|
Site_t *sites;
|
||||||
} typedef SpaceUnit_t;
|
} typedef SpaceUnit_t;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int xmax;
|
int xMax;
|
||||||
int ymax;
|
int yMax;
|
||||||
int zmax;
|
int zMax;
|
||||||
size_t size;
|
size_t size;
|
||||||
SpaceUnit_t *space;
|
SpaceUnit_t *space;
|
||||||
} typedef Space_t;
|
} typedef Space_t;
|
||||||
|
@ -82,8 +82,8 @@ struct {
|
||||||
Space_t *globalDrawingSpace;
|
Space_t *globalDrawingSpace;
|
||||||
IntArray_t *conditionTree;
|
IntArray_t *conditionTree;
|
||||||
ArrowArray_t *arrowArray;
|
ArrowArray_t *arrowArray;
|
||||||
int nmaxThread;
|
int nMaxThread;
|
||||||
int nmaxCycles;
|
int nMaxCycles;
|
||||||
int ruleRadius;
|
int ruleRadius;
|
||||||
pthread_t *id;
|
pthread_t *id;
|
||||||
bool pleaseStop;
|
bool pleaseStop;
|
||||||
|
@ -126,13 +126,28 @@ struct {
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
//
|
||||||
|
// Server
|
||||||
|
//
|
||||||
|
struct {
|
||||||
|
pthread_t *id;
|
||||||
|
bool pleaseStop;
|
||||||
|
int *workerCreationOccurency;
|
||||||
|
} typedef Supervisor_t;
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
//
|
//
|
||||||
// Model
|
// Model
|
||||||
//
|
//
|
||||||
struct {
|
struct {
|
||||||
int id;
|
int id;
|
||||||
int space_xmax;
|
int space_xMax;
|
||||||
int space_ymax;
|
int space_yMax;
|
||||||
int space_zmax;
|
int space_zMax;
|
||||||
|
int nmaxThread;
|
||||||
|
int nmaxCycles;
|
||||||
int siteNumber;
|
int siteNumber;
|
||||||
|
Scheduler_t *scheduler;
|
||||||
|
Supervisor_t *supervisor;
|
||||||
} typedef Model_t;
|
} typedef Model_t;
|
||||||
|
|
|
@ -23,9 +23,12 @@
|
||||||
#include "../include/base.h"
|
#include "../include/base.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ModelPrepareSpace(Space_t *globalDrawingSpace, Model_t *model);
|
void ModelSystemInit(void);
|
||||||
|
|
||||||
void ModelPrepareArrows(Space_t *globalDrawingSpace, ArrowArray_t *arrowList,
|
void ModelSystemDestroy(void);
|
||||||
Model_t *model);
|
|
||||||
|
|
||||||
|
int ModelLoad(int id);
|
||||||
|
|
||||||
|
void ModelCreate(Model_t **newModel);
|
||||||
|
|
||||||
|
int ModelLoad(int id);
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
// Supervisor definition //
|
||||||
|
// //
|
||||||
|
// 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 <https://www.gnu.org/licenses/>. //
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
|
#ifndef BASE_H
|
||||||
|
#include "../include/base.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
// Supervisor init function //
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
void SupervisorInit(Scheduler_t *scheduler);
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
// Supervisor destructor function //
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
static inline void SupervisorDestroy(Scheduler_t *scheduler)
|
||||||
|
{
|
||||||
|
free(scheduler->id);
|
||||||
|
free(scheduler->globalDrawingSpace->space);
|
||||||
|
free(scheduler->globalDrawingSpace);
|
||||||
|
|
||||||
|
free(scheduler->arrowArray->array);
|
||||||
|
free(scheduler->arrowArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
// Supervisor wait function //
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
static inline void SupervisorWait(Scheduler_t *scheduler)
|
||||||
|
{
|
||||||
|
pthread_join(*scheduler->id, NULL);
|
||||||
|
}
|
41
src/cmds.c
41
src/cmds.c
|
@ -23,48 +23,9 @@
|
||||||
#include "../include/scheduler.h"
|
#include "../include/scheduler.h"
|
||||||
#include "../include/model.h"
|
#include "../include/model.h"
|
||||||
|
|
||||||
#define ARROW_NUMBER 6
|
|
||||||
#define SITE_NUMBER 2
|
|
||||||
#define MAX_CYCLES 10
|
|
||||||
#define MAX_THREAD 0
|
|
||||||
#define XMAX 30
|
|
||||||
#define YMAX 0
|
|
||||||
#define ZMAX 0
|
|
||||||
#define SPACE_SIZE (XMAX+1) * (YMAX+1) * (ZMAX+1)
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void *launchScheduler(void *args)
|
void *CmdModel(void *args)
|
||||||
{
|
{
|
||||||
Scheduler_t *scheduler0;
|
|
||||||
Model_t *model0;
|
|
||||||
|
|
||||||
// Creating structure for the Scheduler
|
|
||||||
scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t));
|
|
||||||
|
|
||||||
scheduler0->globalDrawingSpace =
|
|
||||||
(Space_t*) calloc(1, sizeof(Space_t));
|
|
||||||
|
|
||||||
// Creating structure for the model
|
|
||||||
model0 = (Model_t*) calloc(1, sizeof(Model_t));
|
|
||||||
|
|
||||||
model0->space_xmax = XMAX;
|
|
||||||
model0->siteNumber = SITE_NUMBER;
|
|
||||||
|
|
||||||
// Preparing global drawing space
|
|
||||||
ModelPrepareSpace(scheduler0->globalDrawingSpace, model0);
|
|
||||||
|
|
||||||
scheduler0->arrowArray = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t));
|
|
||||||
|
|
||||||
ModelPrepareArrows(scheduler0->globalDrawingSpace, scheduler0->arrowArray, model0);
|
|
||||||
|
|
||||||
scheduler0->nmaxThread = MAX_THREAD;
|
|
||||||
scheduler0->nmaxCycles = MAX_CYCLES;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Creating the Scheduler thread
|
|
||||||
//
|
|
||||||
SchedInit(scheduler0);
|
|
||||||
|
|
||||||
return scheduler0;
|
|
||||||
}
|
}
|
||||||
|
|
132
src/model.c
132
src/model.c
|
@ -21,47 +21,135 @@
|
||||||
|
|
||||||
#include "../include/base.h"
|
#include "../include/base.h"
|
||||||
#include "../include/arrows.h"
|
#include "../include/arrows.h"
|
||||||
|
#include "../include/scheduler.h"
|
||||||
|
|
||||||
#define MAX_MODEL_NUMBER 1
|
#define MAX_MODEL_NUMBER 1
|
||||||
|
#define ARROW_NUMBER 2
|
||||||
|
#define SITE_NUMBER 2
|
||||||
|
#define MAX_CYCLES 10
|
||||||
|
#define MAX_THREAD 0
|
||||||
|
#define XMAX 30
|
||||||
|
#define YMAX 0
|
||||||
|
#define ZMAX 0
|
||||||
|
#define SPACE_SIZE (XMAX+1) * (YMAX+1) * (ZMAX+1)
|
||||||
|
|
||||||
static Model_t *loadedModels;
|
static Model_t **loadedModel;
|
||||||
|
static int loadedModelIndex;
|
||||||
|
|
||||||
void ModelPrepareSpace(Space_t *globalDrawingSpace, Model_t *model)
|
static Model_t **knownModel;
|
||||||
|
static int knownModelIndex;
|
||||||
|
|
||||||
|
static void ModelPrepareSpace(Space_t *globalDrawingSpace, Model_t *model);
|
||||||
|
static void ModelPrepareArrows(Space_t *globalDrawingSpace,
|
||||||
|
ArrowArray_t *arrowArray,
|
||||||
|
Model_t *model);
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ModelSystemInit(void)
|
||||||
{
|
{
|
||||||
globalDrawingSpace->size = (model->space_xmax+1) * (model->space_ymax+1) * (model->space_zmax+1);
|
loadedModel = (Model_t**) calloc(MAX_MODEL_NUMBER, sizeof(Model_t*));
|
||||||
globalDrawingSpace->xmax = model->space_xmax;
|
// XXX read known models from files
|
||||||
globalDrawingSpace->ymax = model->space_ymax;
|
knownModel = (Model_t**) calloc(MAX_MODEL_NUMBER, sizeof(Model_t));
|
||||||
globalDrawingSpace->zmax = model->space_zmax;
|
}
|
||||||
|
|
||||||
|
void ModelSystemDestroy(void)
|
||||||
|
{
|
||||||
|
free(loadedModel);
|
||||||
|
free(knownModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelCreate(Model_t **newModel) // TODO manage deletion and empty slots
|
||||||
|
{
|
||||||
|
knownModel =
|
||||||
|
(Model_t**) realloc(knownModel, ++knownModelIndex * sizeof(Model_t));
|
||||||
|
knownModel[knownModelIndex] = (Model_t*) calloc(1, sizeof(Model_t));
|
||||||
|
knownModel[knownModelIndex]->id = knownModelIndex;
|
||||||
|
*newModel = knownModel[knownModelIndex];
|
||||||
|
|
||||||
|
knownModel[knownModelIndex]->space_xMax = XMAX;
|
||||||
|
knownModel[knownModelIndex]->space_yMax = YMAX;
|
||||||
|
knownModel[knownModelIndex]->space_zMax = ZMAX;
|
||||||
|
knownModel[knownModelIndex]->nmaxThread = MAX_THREAD;
|
||||||
|
knownModel[knownModelIndex]->nmaxCycles = MAX_CYCLES;
|
||||||
|
knownModel[knownModelIndex]->siteNumber = SITE_NUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ModelLoad(int id) // TODO unload !
|
||||||
|
{
|
||||||
|
// Creating structure for the Scheduler
|
||||||
|
knownModel[id]->scheduler = (Scheduler_t*) calloc(1, sizeof(Scheduler_t));
|
||||||
|
|
||||||
|
knownModel[id]->scheduler->globalDrawingSpace =
|
||||||
|
(Space_t*) calloc(1, sizeof(Space_t));
|
||||||
|
|
||||||
|
knownModel[id]->scheduler->nMaxThread = knownModel[id]->nmaxThread;
|
||||||
|
knownModel[id]->scheduler->nMaxCycles = knownModel[id]->nmaxCycles;
|
||||||
|
|
||||||
|
// Preparing global drawing space
|
||||||
|
ModelPrepareSpace(knownModel[id]->scheduler->globalDrawingSpace,
|
||||||
|
knownModel[id]);
|
||||||
|
|
||||||
|
knownModel[id]->scheduler->arrowArray =
|
||||||
|
(ArrowArray_t*) calloc(1, sizeof(ArrowArray_t));
|
||||||
|
|
||||||
|
ModelPrepareArrows(knownModel[id]->scheduler->globalDrawingSpace,
|
||||||
|
knownModel[id]->scheduler->arrowArray, knownModel[id]);
|
||||||
|
|
||||||
|
loadedModel[loadedModelIndex] = knownModel[id];
|
||||||
|
return loadedModelIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelRun(int id)
|
||||||
|
{
|
||||||
|
// Creating structure for the Scheduler
|
||||||
|
SchedInit(knownModel[id]->scheduler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelStop(int id)
|
||||||
|
{
|
||||||
|
// Creating structure for the Scheduler
|
||||||
|
knownModel[id]->scheduler->pleaseStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelDelete(Model_t *newModel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static void ModelPrepareSpace(Space_t *globalDrawingSpace, Model_t *model)
|
||||||
|
{
|
||||||
|
globalDrawingSpace->size =
|
||||||
|
(model->space_xMax+1) * (model->space_yMax+1) * (model->space_zMax+1);
|
||||||
|
globalDrawingSpace->xMax = model->space_xMax;
|
||||||
|
globalDrawingSpace->yMax = model->space_yMax;
|
||||||
|
globalDrawingSpace->zMax = model->space_zMax;
|
||||||
|
|
||||||
globalDrawingSpace->space =
|
globalDrawingSpace->space =
|
||||||
(SpaceUnit_t*) calloc(globalDrawingSpace->size, sizeof(SpaceUnit_t));
|
(SpaceUnit_t*) calloc(globalDrawingSpace->size, sizeof(SpaceUnit_t));
|
||||||
|
|
||||||
for (int i = 0; i < globalDrawingSpace->size; i++) {
|
for (int i = 0; i < globalDrawingSpace->size; i++) {
|
||||||
globalDrawingSpace->space[i].nsite = model->siteNumber;
|
globalDrawingSpace->space[i].nSite = model->siteNumber;
|
||||||
globalDrawingSpace->space[i].sites = (Site_t*) calloc(model->siteNumber, sizeof(Site_t));
|
globalDrawingSpace->space[i].sites =
|
||||||
|
(Site_t*) calloc(model->siteNumber, sizeof(Site_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPrepareArrows(Space_t *globalDrawingSpace, ArrowArray_t *arrowArray,
|
static void ModelPrepareArrows(Space_t *globalDrawingSpace,
|
||||||
|
ArrowArray_t *arrowArray,
|
||||||
Model_t *model)
|
Model_t *model)
|
||||||
{
|
{
|
||||||
arrowArray->array = (Arrow_t*) calloc(6, sizeof(Arrow_t));
|
arrowArray->array = (Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t));
|
||||||
arrowArray->size = 6;
|
arrowArray->size = ARROW_NUMBER; //XXX hardcoded
|
||||||
|
|
||||||
// Creating some arrows
|
// Creating some arrows XXX random walking
|
||||||
globalDrawingSpace->space[3].sites[1].narrow = 1;
|
globalDrawingSpace->space[3].sites[1].nArrow = 1;
|
||||||
arrowArray->array[0].siteId = 1;
|
arrowArray->array[0].siteId = 1;
|
||||||
arrowArray->array[0].x = 3;
|
arrowArray->array[0].x = 3;
|
||||||
|
|
||||||
globalDrawingSpace->space[4].sites[0].narrow = 1;
|
globalDrawingSpace->space[4].sites[0].nArrow = 1;
|
||||||
arrowArray->array[1].siteId = 0;
|
arrowArray->array[1].siteId = 0;
|
||||||
arrowArray->array[1].x = 4;
|
arrowArray->array[1].x = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelInit(void) {
|
|
||||||
loadedModels = (Model_t*) calloc(MAX_MODEL_NUMBER, sizeof(Model_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelDestroy(void) {
|
|
||||||
loadedModels = (Model_t*) calloc(MAX_MODEL_NUMBER, sizeof(Model_t));
|
|
||||||
}
|
|
||||||
|
|
|
@ -83,10 +83,7 @@ static void *schedulerMain(void *scheduler)
|
||||||
// area for a worker to operate on (as an approximation of a spheric one)
|
// area for a worker to operate on (as an approximation of a spheric one)
|
||||||
Center_t *centersList, *workArea;
|
Center_t *centersList, *workArea;
|
||||||
Arrow_t *electedArrow;
|
Arrow_t *electedArrow;
|
||||||
// A cycle is defined as the total renew of all allocated workers. This
|
|
||||||
// measure is used to evaluate the scheduler efficiency.
|
|
||||||
// 1 cycle = n partial cycle / n max worker.
|
|
||||||
int createdWorkers;
|
|
||||||
int ncpu, nworker, err;
|
int ncpu, nworker, err;
|
||||||
|
|
||||||
// Getting scheduler argument structure
|
// Getting scheduler argument structure
|
||||||
|
@ -96,7 +93,7 @@ static void *schedulerMain(void *scheduler)
|
||||||
if (!args->nmaxThread) { // nmaxthread = 0 => no minimum
|
if (!args->nmaxThread) { // nmaxthread = 0 => no minimum
|
||||||
ncpu = get_nprocs(); // allocating all the cpus available
|
ncpu = get_nprocs(); // allocating all the cpus available
|
||||||
} else { // n thread = min(cpu, nmaxthread)
|
} else { // n thread = min(cpu, nmaxthread)
|
||||||
ncpu = MIN(get_nprocs(), args->nmaxThread);
|
ncpu = MIN(get_nprocs(), args->nMaxThread);
|
||||||
}
|
}
|
||||||
printLog("%d threads available.\n", ncpu);
|
printLog("%d threads available.\n", ncpu);
|
||||||
|
|
||||||
|
@ -104,7 +101,6 @@ static void *schedulerMain(void *scheduler)
|
||||||
workerArray = (Worker_t*) calloc(ncpu, sizeof(Worker_t));
|
workerArray = (Worker_t*) calloc(ncpu, sizeof(Worker_t));
|
||||||
nworker = 0;
|
nworker = 0;
|
||||||
centersList = (Center_t*) calloc(1, sizeof(Center_t));
|
centersList = (Center_t*) calloc(1, sizeof(Center_t));
|
||||||
createdWorkers = 0;
|
|
||||||
|
|
||||||
// Initiate the arrowArray lock
|
// Initiate the arrowArray lock
|
||||||
if (err = createArrowLock(args->arrowArray), err != 0) { // TODO destroy this
|
if (err = createArrowLock(args->arrowArray), err != 0) { // TODO destroy this
|
||||||
|
@ -114,8 +110,9 @@ static void *schedulerMain(void *scheduler)
|
||||||
//
|
//
|
||||||
// MAIN LOOP
|
// MAIN LOOP
|
||||||
//
|
//
|
||||||
while (!args->pleaseStop && (createdWorkers / ncpu) <= args->nmaxCycles) {
|
while (!args->pleaseStop && 0 <= args->nMaxCycles) { //XXX count cycles
|
||||||
//printLog("Scheduler #%lu online: cycle %d\n", *args->id, ncycles);
|
//printLog("Scheduler #%lu online: cycle %d\n", *args->id, ncycles);
|
||||||
|
//
|
||||||
|
|
||||||
// TODO statistics here
|
// TODO statistics here
|
||||||
|
|
||||||
|
@ -134,9 +131,9 @@ static void *schedulerMain(void *scheduler)
|
||||||
workArea = findWorkArea(centersList,
|
workArea = findWorkArea(centersList,
|
||||||
electedArrow,
|
electedArrow,
|
||||||
args->ruleRadius,
|
args->ruleRadius,
|
||||||
args->globalDrawingSpace->xmax,
|
args->globalDrawingSpace->xMax,
|
||||||
args->globalDrawingSpace->ymax,
|
args->globalDrawingSpace->yMax,
|
||||||
args->globalDrawingSpace->zmax
|
args->globalDrawingSpace->zMax
|
||||||
);
|
);
|
||||||
releaseArrowLock(args->arrowArray);
|
releaseArrowLock(args->arrowArray);
|
||||||
}
|
}
|
||||||
|
@ -166,8 +163,7 @@ static void *schedulerMain(void *scheduler)
|
||||||
workArea,
|
workArea,
|
||||||
nworker
|
nworker
|
||||||
);
|
);
|
||||||
// Increment partial cycle
|
// Increment partial cycle TODO
|
||||||
createdWorkers++;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ static void *serverMain(void *server)
|
||||||
|
|
||||||
printLog("Client request : %s\n",clientRequest);
|
printLog("Client request : %s\n",clientRequest);
|
||||||
|
|
||||||
for (int i = 0; i < LEN(cmdList); i++) {
|
for (int i = 0; i < LEN(cmdList); i++) { // TODO extract first command name
|
||||||
if (strcmp(cmdList[i].name, clientRequest) == 0) {
|
if (strcmp(cmdList[i].name, clientRequest) == 0) {
|
||||||
cmdList[i].execute(NULL);
|
cmdList[i].execute(NULL);
|
||||||
strcpy(serverAnswer,"OK\0");
|
strcpy(serverAnswer,"OK\0");
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
// Supervisor module //
|
||||||
|
// //
|
||||||
|
// 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 <https://www.gnu.org/licenses/>. //
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
|
#include "../include/base.h"
|
||||||
|
|
||||||
|
static void *supervisorMain(void *scheduler);
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
// Supervisor init function //
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
void SupervisorInit(Scheduler_t *scheduler)
|
||||||
|
{
|
||||||
|
scheduler->id = (pthread_t*) calloc(1, sizeof(pthread_t));
|
||||||
|
pthread_create(scheduler->id, NULL, supervisorMain, scheduler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
// Supervisor thread main function //
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
static void *supervisorMain(void *scheduler)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
Loading…
Reference in New Issue