some lisibility improvements

This commit is contained in:
Adrien Bourmault 2021-06-23 11:06:36 +02:00
parent 7c4c43b996
commit 18077df85b
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
2 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ static inline int acquireArrowLock(ArrowArray_t *arrowArray)
return pthread_spin_lock(&arrowArray->lock);
}
static inline int acquireNonBlockinArrowgLock(ArrowArray_t *arrowArray)
static inline int acquireNonBlockingArrowLock(ArrowArray_t *arrowArray)
{
return pthread_spin_trylock(&arrowArray->lock);
}

View File

@ -45,7 +45,7 @@ void SchedInit(Scheduler_t *scheduler)
// Scheduler area finder function //
// -------------------------------------------------------------------------- //
static Center_t *findWorkArea(Center_t *centersList, Arrow_t *electedArrow,
int ruleRadius, size_t spaceSize, int xmax, int ymax, int zmax)
int ruleRadius, int xmax, int ymax, int zmax)
{
register Center_t *currentCenter, *newCenter;
@ -124,14 +124,15 @@ static void *schedulerMain(void *scheduler)
workArea = NULL;
// Acquiring lock to consistently read the arrowArray
if (acquireNonBlockinArrowgLock(args->arrowArray)) {
if (acquireNonBlockingArrowLock(args->arrowArray)) {
// Random choice of an arrow
electedArrow =
&args->arrowArray->array[rand() % args->arrowArray->size];
// Find a local area
workArea = findWorkArea(centersList, electedArrow, args->ruleRadius,
args->globalDrawingSpace->size,
workArea = findWorkArea(centersList,
electedArrow,
args->ruleRadius,
args->globalDrawingSpace->xmax,
args->globalDrawingSpace->ymax,
args->globalDrawingSpace->zmax
@ -141,13 +142,12 @@ static void *schedulerMain(void *scheduler)
// If a free area exists,
if (workArea) {
//printLog("A free workArea exists at %p\n", workArea);
// preempt it,
CenterAdd(centersList, workArea);
// find a worker socket,
for (int i = 0; i < ncpu; i++) {
if (!workerArray[i].id) {
//printLog("Adding worker at rank %d\n", i);
// if a location is empty
if (workerArray[i].id == 0) {
// prepare the worker for the area,
workerArray[i].localWorkAreaCenter = workArea;
workerArray[i].globalDrawingSpace =