Skip to content

Commit

Permalink
Merge 3365518 into fbdac7b
Browse files Browse the repository at this point in the history
  • Loading branch information
msimberg authored Dec 14, 2022
2 parents fbdac7b + 3365518 commit e5d48e2
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions libs/pika/logging/src/format/formatter/thread_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,12 @@
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <fmt/printf.h>
#include <fmt/std.h>

#include <memory>
#include <ostream>
#include <type_traits>

#if defined(PIKA_WINDOWS)
#include <windows.h>
#else
#include <pthread.h>
#endif

namespace pika::util::logging::formatter {

thread_id::~thread_id() = default;
Expand All @@ -41,20 +36,8 @@ namespace pika::util::logging::formatter {
{
void operator()(std::ostream& to) const override
{
auto id =
#if defined(PIKA_WINDOWS)
::GetCurrentThreadId();
#else
pthread_self();
#endif
if constexpr (std::is_pointer_v<decltype(id)>)
{
fmt::print(to, "{}", fmt::ptr(id));
}
else
{
fmt::print(to, "{}", id);
}
auto id = std::this_thread::get_id();
fmt::print(to, "{}", id);
}
};

Expand Down

0 comments on commit e5d48e2

Please sign in to comment.