rt_benchs/communication_techniques/include/pipe_comm.h

36 lines
632 B
C

#ifndef __COMM_H_
#define __COMM_H_ 1
#include <stdint.h>
#include <unistd.h>
/* Non standart include */
#include <specific_comm.h>
#define READ_IDX 0
#define WRITE_IDX 1
struct communication_assoc
{
struct communication_assoc *next;
struct communication_assoc *prev;
pthread_t tid;
int *pipefd;
struct communication_channel *channel;
int receiver_idx;
};
__BEGIN_DECLS
extern __thread int pipefd[];
extern struct communication_assoc assoc_root;
struct communication_assoc *create_comm_assoc(void);
static inline void send(uintptr_t value) {
write(pipefd[WRITE_IDX], &value, sizeof(uintptr_t));
}
__END_DECLS
#endif