有谁知道在 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
并尝试了(长)系统调用(229)但不起作用(它崩溃)。在 Linux 上,我可以通过系统调用 (long) syscall(224) 获取线程 ID,它给了我一个整数(通常是 4 位数字)。有人可以帮忙吗?!谢谢你。