summaryrefslogtreecommitdiff
path: root/src/init/lib/esemaphore.h
diff options
context:
space:
mode:
authordzwdz2022-07-10 11:38:53 +0200
committerdzwdz2022-07-10 11:38:53 +0200
commit45c5bf044a063a289fad6a53b8d27ce675d9c272 (patch)
treed3e4f2f59d2bbf825ad4bf81b821934a27835ffa /src/init/lib/esemaphore.h
parentf6039ca691352bce5d050a4e5ffa768fadbaf68c (diff)
init/lib: implement "evil semaphores"
I started implementing native semaphores in the kernel, but then I've realized that I can implement them in userland using pipes. Thus, this hot garbage was born.
Diffstat (limited to 'src/init/lib/esemaphore.h')
-rw-r--r--src/init/lib/esemaphore.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/init/lib/esemaphore.h b/src/init/lib/esemaphore.h
new file mode 100644
index 0000000..e746bd7
--- /dev/null
+++ b/src/init/lib/esemaphore.h
@@ -0,0 +1,12 @@
+#pragma once
+#include <shared/types.h>
+
+struct evil_sem {
+ handle_t wait, signal;
+};
+
+void esem_signal(struct evil_sem *sem);
+void esem_wait(struct evil_sem *sem);
+
+struct evil_sem *esem_new(int value);
+void esem_free(struct evil_sem *sem);