about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-03-20 17:34:42 +0100
committerChristian Krinitsin <mail@krinitsin.com>2025-03-20 17:34:42 +0100
commit1784e4a2a938bdef104135bfbf03f7b47ca0b507 (patch)
treef468d4ce735ff9c19c1863f32112644a89b034e2
parenteb5b1f073c24a7172714cd6731475ef4beeed7a3 (diff)
downloadBT-Programming-Assignment-1784e4a2a938bdef104135bfbf03f7b47ca0b507.tar.gz
BT-Programming-Assignment-1784e4a2a938bdef104135bfbf03f7b47ca0b507.zip
server: add common structure for shared memory
-rw-r--r--src/common/shared_memory.h16
1 files changed, 16 insertions, 0 deletions
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 <pthread.h>
+
+#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;
+};