Fix variable names & use pthreads library

This commit is contained in:
Glenn Y. Rolland 2019-09-17 14:39:18 +02:00
parent ac6631c427
commit f99f7ca60f
2 changed files with 10 additions and 10 deletions

View file

@ -23,8 +23,8 @@ void * msgAllocate(msgSpace *space,
float semPoolCoef[space->poolNb];
int idxPoolOptimum;
bool gotRessourceSem;
sem_t * poolDataSemFd=NULL;
msgPoolDataSemId ressourceSemId;
sem_t * poolDataTabSemFd=NULL;
msgPoolDataTabSemId ressourceSemId;
sem_t * ressourceSemFd=NULL;
int * ressourceSemVal=NULL;
float minPoolCoef;
@ -33,10 +33,10 @@ void * msgAllocate(msgSpace *space,
selectedIdx=-1;
/* TODO: verifier le premier arg du shm_open */
mSPoolDataTabFd=shm_open(space->poolDataId,O_RDWR,MSGSPACE_DEFAULT_MODE);
mSPoolDataTabFd=shm_open(space->poolDataTabId,O_RDWR,MSGSPACE_DEFAULT_MODE);
if (mSPoolDataTabFd == -1 ) {
fprintf( stderr, "Allocate %s failed: %s\n",
(char*)space->poolDataId,
(char*)space->poolDataTabId,
strerror( errno ) );
return NULL;
}
@ -142,13 +142,13 @@ void * msgAllocate(msgSpace *space,
/* on a acqui un semaphore pour la ressouce */
/* on acquiert le droit de modifier les infos sur la ressource */
poolDataSemFd=sem_open(space->poolDataSemId,O_CREAT,SEM_DEFAULT_MODE,1);
poolDataTabSemFd=sem_open(space->poolDataTabSemId,O_CREAT,SEM_DEFAULT_MODE,1);
/* on modifie maintenant les données */
/* TODO: mapper le buffer libre dans l'esp addr du proc */
sem_close(poolDataSemFd);
sem_close(poolDataTabSemFd);
/* TODO: unmapper le msgPoolDataTab */

View file

@ -11,8 +11,8 @@ CC=gcc
CFLAGS=-Wall --static -O2 -ggdb
#-O2 -ggdb
INCLUDES=-I ../src/
LIBINC=-L ../src -L /usr/lib
INCLUDES=-I /usr/include -I ../src/
LIBINC=-L /usr/lib -L ../src
LIBS=-lnazgul
ifeq "SunOS" "${OS}"
@ -20,7 +20,7 @@ ifeq "SunOS" "${OS}"
endif
ifeq "Linux" "${OS}"
LIBS=-lnazgul -lrt
LIBS=-lnazgul -lrt -lpthread
endif
PRJNAME=Libnazgul
@ -42,5 +42,5 @@ clean:
@rm -f $(FILES)
% : %.c
$(CC) $(CFLAGS) $< -o $* $(INCLUDES) $(LIBINC) $(LIBS)
$(CC) -o $* $< $(INCLUDES) $(LIBINC) $(LIBS) $(CFLAGS)