From 1784e4a2a938bdef104135bfbf03f7b47ca0b507 Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Thu, 20 Mar 2025 17:34:42 +0100 Subject: server: add common structure for shared memory --- src/common/shared_memory.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/common/shared_memory.h (limited to 'src/common/shared_memory.h') diff --git a/src/common/shared_memory.h b/src/common/shared_memory.h new file mode 100644 index 0000000..53c7fb7 --- /dev/null +++ b/src/common/shared_memory.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +#define QUEUE_SIZE 10 +#define SHM_NAME "/hashtable_queue" + +enum Operations { INSERT, DELETE, GET }; + +struct SharedMemory { + pthread_mutex_t mutex; + pthread_cond_t cond_var; + Operations queue[QUEUE_SIZE]; + int head; + int tail; +}; -- cgit 1.4.1