rt_benchs/communication_techniques/src/common.c

23 lines
463 B
C

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
/* Non standard include */
#include <specific_comm.h>
struct thread_comm *tcomms;
volatile int cont = 1;
int init_library()
{
tcomms = (struct thread_comm *) malloc(nb_prod * sizeof(struct thread_comm));
if (tcomms == NULL)
{
fprintf(stderr, "Failed to allocate %lu bytes needed by the library to work\n", nb_prod * sizeof(struct thread_comm));
return -1;
}
return 0;
}