findWorkArea
This commit is contained in:
parent
dd45f7794a
commit
af433e8a90
|
@ -23,6 +23,7 @@
|
|||
#include "../include/localworker.h"
|
||||
|
||||
#include <sys/sysinfo.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void *GreatScheduler(void *parameters);
|
||||
|
||||
|
@ -98,19 +99,21 @@ static void *GreatScheduler(void *params)
|
|||
// -------------------------------------------------------------------------- //
|
||||
// Scheduler thread main function //
|
||||
// -------------------------------------------------------------------------- //
|
||||
static Center_t *findWorkArea(Center_t *centerList, long ruleRadius)
|
||||
static Center_t *findWorkArea(Center_t *centerList, int ruleRadius)
|
||||
{
|
||||
Center_t *myCenter = 10; /* Je suis né quelque part.(ou pas !).*/
|
||||
Center_t *myCenter = (Center_t*) malloc(sizeof(Center_t));
|
||||
centerAssign(myCenter, 10, 0, 0); /* Je suis né quelque part.(ou pas !).*/
|
||||
|
||||
int i;
|
||||
for (i = 0; i < centerList.size() - 1; i ++){
|
||||
if (myCenter - centerList[i] < ruleRadius){
|
||||
printLog("FAIL: no work area available at %p\n", myCenter);
|
||||
while (centerList != NULL){
|
||||
if (abs(myCenter->x - centerList->x) < ruleRadius){
|
||||
printLog("FAIL: no work area available at %d\n", myCenter->x);
|
||||
free(myCenter);
|
||||
return NULL;
|
||||
}
|
||||
centerList = centerList->next;
|
||||
}
|
||||
|
||||
printLog("SUCCESS ! at %p: < I've find a center.\n", myCenter);
|
||||
printLog("SUCCESS ! at %d: < I've find a center.\n", myCenter->x);
|
||||
|
||||
return myCenter;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue