提交 87af511b 编写于 作者: A Alexey Milovidov

Rename function #7477

上级 39b31907
......@@ -17,7 +17,7 @@ set (COMMON_SRCS
src/DateLUTImpl.cpp
src/demangle.cpp
src/getMemoryAmount.cpp
src/getThreadNumber.cpp
src/getThreadId.cpp
src/JSON.cpp
src/LineReader.cpp
src/mremap.cpp
......@@ -36,7 +36,7 @@ set (COMMON_SRCS
include/common/ErrorHandlers.h
include/common/find_symbols.h
include/common/getMemoryAmount.h
include/common/getThreadNumber.h
include/common/getThreadId.h
include/common/JSON.h
include/common/likely.h
include/common/LineReader.h
......
#pragma once
/// Obtain thread id from OS. The value is cached in thread local variable.
unsigned getThreadNumber();
#include <unistd.h>
#include <syscall.h>
static thread_local unsigned current_tid = 0;
unsigned getThreadNumber()
{
if (!current_tid)
current_tid = syscall(SYS_gettid); /// This call is always successful. - man gettid
return current_tid;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册