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 }