1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sync: document sync.thread_id()

This commit is contained in:
Delyan Angelov 2022-03-23 19:48:13 +02:00
parent ce576d01c4
commit 5b668dba2b
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -2,6 +2,14 @@ module sync
fn C.pthread_self() usize
// thread_id returns a unique identifier for the caller thread.
// All *currently* running threads in the same process, will have *different* thread identifiers.
// Note: if a thread finishes, and another starts, the identifier of the old thread may be
// reused for the newly started thread.
// In other words, thread IDs are guaranteed to be unique only within a process.
// A thread ID may be reused after a terminated thread has been joined (with `t.wait()`),
// or when the thread has terminated.
pub fn thread_id() u64 {
return u64(C.pthread_self())
}