提交 c7ece60e 编写于 作者: L liaogang

add gettid syscall for MAC OS

上级 70cceb0c
...@@ -23,10 +23,14 @@ namespace paddle { ...@@ -23,10 +23,14 @@ namespace paddle {
// return the thread id used by glog // return the thread id used by glog
pid_t getTID() { pid_t getTID() {
#ifndef __NR_gettid #if defined(__APPLE__) || defined(__OSX__)
#define __NR_gettid 224 pid_t tid = syscall(SYS_thread_selfid);
#endif #elif defined(__LINUX__)
#ifndef __NR_gettid
#define __NR_gettid 224
#endif
pid_t tid = syscall(__NR_gettid); pid_t tid = syscall(__NR_gettid);
#endif
CHECK_NE(tid, -1); CHECK_NE(tid, -1);
return tid; return tid;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册