C++获取线程 ID 跨平台
uint64_t getCurrentThreadId() {
#if defined(__ANDROID__)
return gettid();
#elif defined(__APPLE__)
uint64_t tid;
pthread_threadid_np(nullptr, &tid);
return tid;
#elif defined(__linux__)
return syscall(__NR_gettid);
#elif defined(_WIN32)
return GetCurrentThreadId();
#endif
}
待完善