有谁知道在 BSD 上以整数形式获取当前线程 ID 吗?
我找到了这个
#ifdef RTHREADS
299 STD { pid_t sys_getthrid(void); }
300 STD { int sys_thrsleep(void *ident, int timeout, void *lock); }
301 STD { int sys_thrwakeup(void *ident, int n); }
302 STD { int sys_threxit(int rval); }
303 STD { int sys_thrsigdivert(sigset_t sigmask); }
#else
299 UNIMPL
300 UNIMPL
301 UNIMPL
302 UNIMPL
303 UNIMPL
#endif
Run Code Online (Sandbox Code Playgroud)
并尝试了(长)syscall(229)但不起作用(它崩溃了)。在 Linux 上,我可以通过系统调用(长)syscall(224) 获取线程 ID,它给我一个整数(通常是 4 位数字)。任何人都可以帮忙吗?谢谢。