diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-06 20:55:07 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-06 20:55:07 +0200 |
commit | f255db0f9252f4041b120dcaa00470889c4cb9f4 (patch) | |
tree | 94a56d2acc3cacdaebdae1dd9b37d533b9e7368f /glfw/src/util.rs | |
parent | e40fd63dd35430f234d65806ca7e0d6bea364bfc (diff) |
feat: add GLFW wrapper library
Diffstat (limited to 'glfw/src/util.rs')
-rw-r--r-- | glfw/src/util.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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 +} |