From f255db0f9252f4041b120dcaa00470889c4cb9f4 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 6 Oct 2023 20:55:07 +0200 Subject: feat: add GLFW wrapper library --- glfw/src/util.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 glfw/src/util.rs (limited to 'glfw/src/util.rs') diff --git a/glfw/src/util.rs b/glfw/src/util.rs new file mode 100644 index 0000000..f77aaf8 --- /dev/null +++ b/glfw/src/util.rs @@ -0,0 +1,10 @@ +use libc::{c_long, getpid, syscall, SYS_gettid}; + +pub fn is_main_thread() -> bool +{ + let ttid = unsafe { syscall(SYS_gettid) }; + + let pid = c_long::from(unsafe { getpid() }); + + ttid == pid +} -- cgit v1.2.3-18-g5258