summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/Defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'dev/LibCompiler/Defines.h')
-rw-r--r--dev/LibCompiler/Defines.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/dev/LibCompiler/Defines.h b/dev/LibCompiler/Defines.h
index 1735606..24d9a96 100644
--- a/dev/LibCompiler/Defines.h
+++ b/dev/LibCompiler/Defines.h
@@ -138,6 +138,15 @@ inline bool to_str(CharType* str, Int32 limit, Int32 base) noexcept {
return true;
}
+inline bool install_signal(Int32 signal, void (*handler)(int)) noexcept {
+ if (handler == nullptr) return false;
+
+ if (::signal(signal, handler) == SIG_ERR) {
+ return false;
+ }
+
+ return true;
+}
} // namespace LibCompiler
#define PACKED __attribute__((packed))