We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b68dd9b commit c8ffee2Copy full SHA for c8ffee2
1 file changed
src/pal/pal.h
@@ -168,10 +168,23 @@ namespace snmalloc
168
Pal::error(msg.get_message());
169
}
170
171
+ static size_t get_tid()
172
+ {
173
+ static inline thread_local size_t tid {0};
174
+ static inline std::atomic<size_t> tid_source {1};
175
+
176
+ if (tid == 0)
177
178
+ tid = tid_source++;
179
+ }
180
+ return tid;
181
182
183
template<size_t BufferSize, typename... Args>
184
inline void message(Args... args)
185
{
186
MessageBuilder<BufferSize> msg{std::forward<Args>(args)...};
- Pal::message(msg.get_message());
187
+ MessageBuilder<BufferSize> msg_tid{"{}: {}", get_tid(), msg.get_message()};
188
+ Pal::message(msg_tid.get_message());
189
190
} // namespace snmalloc
0 commit comments