Copyright (c) 2016 The FreeBSD Foundation, Inc. All rights reserved. This documentation was written by Konstantin Belousov <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form...
NAMEthr_self - return thread identifier for the calling thread
SYNOPSISIn sys/thr.h Ft int Fn thr_self long *id
DESCRIPTIONThe Fn 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 (10002) 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 VALUESIf successful, Fn thr_self will return zero, otherwise -1 is returned, and errno is set to indicate the error.
ERRORSThe Fn thr_self operation may return the following errors:
- Bq Er EFAULT
- The memory pointed to by the Fa id argument is not valid.