#pthreads #current-thread

gettid

Helper to get an integer ID for the current thread

5 releases

0.1.4 Aug 20, 2025
0.1.3 Jun 21, 2024
0.1.2 Jun 25, 2020
0.1.1 Feb 20, 2020
0.1.0 May 4, 2019

#2 in #current-thread

Download history 19830/week @ 2026-01-19 24899/week @ 2026-01-26 28582/week @ 2026-02-02 23877/week @ 2026-02-09 26018/week @ 2026-02-16 24743/week @ 2026-02-23 32455/week @ 2026-03-02 33498/week @ 2026-03-09 45414/week @ 2026-03-16 36126/week @ 2026-03-23 43656/week @ 2026-03-30 43252/week @ 2026-04-06 26930/week @ 2026-04-13 36836/week @ 2026-04-20 35778/week @ 2026-04-27 44148/week @ 2026-05-04

144,632 downloads per month
Used in 4 crates (3 directly)

0BSD license

4KB

gettid

A crate to help with fetching thread IDs across multiple platforms.

use gettid::gettid;

let main_tid = gettid();
let pid = std::process::id();
let thread_tid = std::thread::spawn(gettid).join().unwrap();
assert_ne!(main_tid, thread_tid);

Dependencies

~42KB