thr_self2
Return thread identifier for the calling thread
Usage
#include <sys/thr.h>
int
thr_self(long *id);
Library
Standard C Library (libc, -lc)
Overview
The thr_self() system call stores the system-wide thread identifier for the current kernel-scheduled thread in the variable pointed by the argument id.
The thread identifier is an integer in the range from PID_MAX + 2 (100001) to INT_MAX. The thread identifier is guaranteed to be unique at any given time, for each running thread in the system. After the thread exits, the identifier may be reused.
Return values
If successful, thr_self() will return zero, otherwise -1 is returned, and errno is set to indicate the error.
Errors
The thr_self() operation may return the following errors:
- [EFAULT]
-
The memory pointed to by the id argument is not valid.
Releases
25 releases since FreeBSD 11.0-RELEASE; the text changed 12 times.