#ifndef __COMM_H_ #define __COMM_H_ 1 #include /* Non standard include */ #include #define SHARED_SPACE_SIZE (2 * CACHE_LINE_SIZE) struct communication_assoc { struct communication_assoc *next; struct communication_assoc *prev; pthread_t tid; uintptr_t *shared_space; int *cons_idx; int *prod_idx; }; extern struct communication_assoc assoc_root; __BEGIN_DECLS extern __thread uintptr_t *shared_space; extern __thread int prod_idx; struct communication_assoc *create_comm_assoc(void); static inline void send(uintptr_t value) { shared_space[prod_idx] = value; prod_idx = (prod_idx + 1) % SHARED_SPACE_SIZE; } __END_DECLS #endif