1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 16:24:02 +00:00

perf: cache the result of thread_current_id() (#4425)

This commit is contained in:
Charles Kerr 2022-12-20 14:59:02 -06:00 committed by GitHub
parent ebc93788ce
commit 1e734f36b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,7 +107,8 @@ int cond_wait(void* vcond, void* vlock, struct timeval const* tv)
unsigned long thread_current_id()
{
return std::hash<std::thread::id>()(std::this_thread::get_id());
thread_local auto const hashed = std::hash<std::thread::id>()(std::this_thread::get_id());
return hashed;
}
void initEvthreadsOnce()