about summary refs log tree commit diff
path: root/src/pOS/arch/x86/kernel/signals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pOS/arch/x86/kernel/signals.cpp')
-rw-r--r--src/pOS/arch/x86/kernel/signals.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/pOS/arch/x86/kernel/signals.cpp b/src/pOS/arch/x86/kernel/signals.cpp
new file mode 100644
index 0000000..b43c9fb
--- /dev/null
+++ b/src/pOS/arch/x86/kernel/signals.cpp
@@ -0,0 +1,33 @@
+#include <kernel/signals.h>
+
+static int index = 0;
+
+static void* singnal_handlers[10] =
+{
+    0,0,0,0,0,0,0,0,0,0
+};
+
+int Signals::send_signal(Signal_Type signal)
+{
+    for(size_t i = 0; i < 10; i++)
+    {
+        void (*handler)(Signal_Type sig);
+
+        handler = reinterpret_cast<void (*)(Signal_Type sig)>(singnal_handlers[i]);
+        if (handler)
+        {
+            handler(signal);
+        }
+    }
+
+    return 0;
+}
+
+int Signals::register_recieve(void (*handler)(Signal_Type sig))
+{
+    singnal_handlers[index++] = reinterpret_cast<void *&>(handler);
+    if(index >= 10)         /* 10 max, temp*/
+        index = 0;
+
+    return 0;
+}