From 68589566a77f8abd919bf192394f6dd40d586edb Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Wed, 17 Jun 2009 15:47:12 +0200 Subject: [PATCH] Communication techniques bench: add fake comm --- communication_techniques/Makefile | 2 +- communication_techniques/include/fake_comm.h | 30 ++++++++++++++++++++ communication_techniques/src/fake.c | 25 ++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 communication_techniques/include/fake_comm.h create mode 100644 communication_techniques/src/fake.c diff --git a/communication_techniques/Makefile b/communication_techniques/Makefile index e88ff57..65c4781 100644 --- a/communication_techniques/Makefile +++ b/communication_techniques/Makefile @@ -18,7 +18,7 @@ LDFLAGS=-L$(LIBDIR) -L$(LOCALDIR)/$(PAPIHIGHLEVELLIBDIR) -Wl,-rpath-link,$(HOME) CC=gcc # Files -BINNAMES=asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm +BINNAMES=asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm BINS=$(patsubst %, $(BINDIR)/%, $(BINNAMES)) MAIN_OBJS=main.o common.o COMMON_LIB_OBJS=common.o diff --git a/communication_techniques/include/fake_comm.h b/communication_techniques/include/fake_comm.h new file mode 100644 index 0000000..90c2e95 --- /dev/null +++ b/communication_techniques/include/fake_comm.h @@ -0,0 +1,30 @@ +#ifndef __COMM_H_ +#define __COMM_H_ 1 + +#include + +/* Non standard include */ +#include + +#define FAKE_NURSERY_START 1 + +struct communication_assoc +{ + struct communication_assoc *next; + struct communication_assoc *prev; + pthread_t tid; +}; + +extern struct communication_assoc assoc_root; + +__BEGIN_DECLS + +struct communication_assoc *create_comm_assoc(void); +static inline void send(void **addr) { + static __thread void **store_var = NULL; + store_var = addr; +} + +__END_DECLS + +#endif diff --git a/communication_techniques/src/fake.c b/communication_techniques/src/fake.c new file mode 100644 index 0000000..a47de81 --- /dev/null +++ b/communication_techniques/src/fake.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +/* Non standard include */ +#include +#include + + +struct communication_assoc *create_comm_assoc(void) +{ + struct communication_assoc *assoc; + + assoc = (struct communication_assoc *) malloc(sizeof(struct communication_assoc)); + assoc->tid = pthread_self(); + return assoc; +} + +void reception(void (*on_receive)(void *)) +{ + wait_initialization(); + /* printf("Activate the consumer...\n"); */ + while (cont); +}