1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Thread ID utilities for capturing OS-level thread identifiers.
//!
//! This module provides cross-platform functions to retrieve the current thread's
//! OS-level thread ID (TID), which is useful for debugging and profiling.
use Cell;
thread_local!
/// Return the OS thread ID (TID) as u64.
///
/// # Platform Support
///
/// - **Linux**: Uses `syscall(SYS_gettid)` to get the kernel thread ID
/// - **macOS**: Uses `pthread_self()` + `pthread_mach_thread_np()` to get the Mach thread ID
///
/// # Panics
///
/// This function will fail to compile on unsupported platforms.
pub