Test and Set 2
This commit is contained in:
parent
33f71e89f6
commit
ea7a712728
1 changed files with 15 additions and 18 deletions
|
@ -11,7 +11,6 @@
|
|||
#include "iAcquisitionManager.h"
|
||||
#include "debug.h"
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#define gettid() syscall(SYS_gettid)
|
||||
|
||||
|
@ -73,23 +72,21 @@ static void pCountLockRelease(){
|
|||
|
||||
static unsigned int createSynchronizationObjects(void)
|
||||
{
|
||||
//Initialisation des sémaphores
|
||||
semaphore_libre = sem_open("/acquisitionManager_semLibre", O_CREAT, 0644, BUFFER_SIZE);
|
||||
if (semaphore_libre == SEM_FAILED)
|
||||
{
|
||||
perror("[sem_open");
|
||||
return ERROR_INIT;
|
||||
}
|
||||
|
||||
semaphore_occupe = sem_open("/acquisitionManager_semLibre", O_CREAT, 0644, 0);
|
||||
if (semaphore_occupe == SEM_FAILED)
|
||||
{
|
||||
perror("[sem_open");
|
||||
return ERROR_INIT;
|
||||
}
|
||||
//----Fin de l'initialisation sémaphore -----
|
||||
printf("[acquisitionManager]Semaphore created\n");
|
||||
return ERROR_SUCCESS;
|
||||
int error;
|
||||
|
||||
//TODO DONE
|
||||
if((error = sem_init(&semaphore_libre, 0, BUFFER_SIZE)) < 0){
|
||||
printf("[acquisitionManager]Semaphore L Error No. %d\n",error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if((error = sem_init(&semaphore_occupe, 0, 0)) < 0){
|
||||
printf("[acquisitionManager]Semaphore O Error No. %d\n",error);
|
||||
return error;
|
||||
}
|
||||
|
||||
printf("[acquisitionManager]Semaphore created\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static void incrementProducedCount(void)
|
||||
|
|
Loading…
Reference in a new issue