maint: Replace use of folly getCurrentThreadId with STL #1417
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
What does this implement or fix?
This is work to assist @jjerphan in removing use of folly in the ArcticDB code base.
The change here is to remove use of
folly::getCurrentThreadID()
inget_thread_id()
, replacing it with use ofstd::this_thread::get_id()
.This replaces #1408 and is submitted from a branch of the main repo rather than my fork so that CI runs automatically.
Any other comments?
The folly implementation is much more complicated as there are different implementation for the 3 major OSes:
https://github.com/facebook/folly/blob/69a1b93df285457cd0799a6898e2e5390a09cd73/folly/system/ThreadId.cpp#L29-L37
The different implementations are not required as the STL C++11 solution should work on all OSes. Following
#1408 (comment) the solution here returns a
std::thread::id
rather than auint64_t
and this is formatted correctly in log messages (the only use of thread ID) by including<fmt/std.h>
.Checklist
Checklist for code changes...