logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface

Application Usage

       None.

Description

       The pthread_self() function shall return the thread ID of the calling thread.

Errors

       No errors are defined.

       Thefollowingsectionsareinformative.

Examples

       None.

Future Directions

       None.

Name

       pthread_self — get the calling thread ID

Prolog

       This  manual  page  is part of the POSIX Programmer's Manual.  The Linux implementation of this interface
       may differ (consult the corresponding Linux manual page for details of Linux behavior), or the  interface
       may not be implemented on Linux.

Rationale

       The pthread_self() function provides a capability similar to the getpid() function for processes and  the
       rationale is the same: the creation call does not provide the thread ID to the created thread.

Return Value

       The  pthread_self()  function  shall  always be successful and no return value is reserved to indicate an
       error.

See Also

pthread_create(), pthread_equal()

       The Base Definitions volume of POSIX.1‐2017, <pthread.h>

Synopsis

       #include <pthread.h>

       pthread_t pthread_self(void);

See Also