From 45c5bf044a063a289fad6a53b8d27ce675d9c272 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 10 Jul 2022 11:38:53 +0200 Subject: 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. --- src/init/lib/esemaphore.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/init/lib/esemaphore.h (limited to 'src/init/lib/esemaphore.h') 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 + +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); -- cgit v1.2.3