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 "iAcquisitionManager.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
|
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#define gettid() syscall(SYS_gettid)
|
#define gettid() syscall(SYS_gettid)
|
||||||
|
|
||||||
|
@ -73,23 +72,21 @@ static void pCountLockRelease(){
|
||||||
|
|
||||||
static unsigned int createSynchronizationObjects(void)
|
static unsigned int createSynchronizationObjects(void)
|
||||||
{
|
{
|
||||||
//Initialisation des sémaphores
|
int error;
|
||||||
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);
|
//TODO DONE
|
||||||
if (semaphore_occupe == SEM_FAILED)
|
if((error = sem_init(&semaphore_libre, 0, BUFFER_SIZE)) < 0){
|
||||||
{
|
printf("[acquisitionManager]Semaphore L Error No. %d\n",error);
|
||||||
perror("[sem_open");
|
return error;
|
||||||
return ERROR_INIT;
|
}
|
||||||
}
|
|
||||||
//----Fin de l'initialisation sémaphore -----
|
if((error = sem_init(&semaphore_occupe, 0, 0)) < 0){
|
||||||
printf("[acquisitionManager]Semaphore created\n");
|
printf("[acquisitionManager]Semaphore O Error No. %d\n",error);
|
||||||
return ERROR_SUCCESS;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[acquisitionManager]Semaphore created\n");
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void incrementProducedCount(void)
|
static void incrementProducedCount(void)
|
||||||
|
|
Loading…
Reference in a new issue