MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / gettid

Function gettid

src/fastlock.cpp:167–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167extern "C" pid_t gettid()
168{
169 static thread_local int pidCache = -1;
170#ifdef __linux__
171 if (pidCache == -1)
172 pidCache = syscall(SYS_gettid);
173#else
174 if (pidCache == -1) {
175 uint64_t tidT;
176#ifdef __FreeBSD__
177// Check https://github.com/ClickHouse/ClickHouse/commit/8d51824ddcb604b6f179a0216f0d32ba5612bd2e
178 tidT = pthread_getthreadid_np();
179#else
180 pthread_threadid_np(nullptr, &tidT);
181#endif
182 serverAssert(tidT < UINT_MAX);
183 pidCache = (int)tidT;
184 }
185#endif
186 return pidCache;
187}
188
189void printTrace()
190{

Callers 8

createDiskBacklogFunction · 0.85
serverLogRawFunction · 0.85
printTraceFunction · 0.85
fastlock_lockFunction · 0.85
fastlock_trylockFunction · 0.85
fastlock_freeFunction · 0.85
fOwnLockMethod · 0.85
bulkInsertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected