CCF
Loading...
Searching...
No Matches
thread_ids.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#define FMT_HEADER_ONLY
6#include <fmt/format.h>
7#include <fmt/ostream.h>
8#include <fmt/std.h>
9#include <limits>
10#include <map>
11#include <thread>
12
14{
15 // Assign monotonic thread IDs for display + storage
16 using ThreadID = uint16_t;
17 static constexpr ThreadID invalid_thread_id =
18 std::numeric_limits<ThreadID>::max();
19
20 static constexpr ThreadID MAIN_THREAD_ID = 0;
21
22 uint16_t get_current_thread_id();
24 void reset_thread_id_generator(ThreadID to = MAIN_THREAD_ID);
25}
Definition thread_ids.h:14
uint16_t ThreadID
Definition thread_ids.h:16
void set_current_thread_id(ThreadID to)
Definition thread_local.cpp:20
void reset_thread_id_generator(ThreadID to=MAIN_THREAD_ID)
Definition thread_local.cpp:25
uint16_t get_current_thread_id()
Definition thread_local.cpp:15