#include <sys/lwp.h>
The _lwp_self() function returns the ID of the calling LWP.
See attributes(5) for descriptions of the following attributes:
_lwp_create(2), attributes(5)