Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Thread IDs

Each thread within a process is uniquely identified by a thread ID. This ID is returned to the caller of pthread_create(), and a thread can obtain its own ID using pthread_self().

include <pthread.h>

pthread_t pthread_self(void);

Note

Returns the thread ID of the calling thread

Thread IDs are useful within applications for the following reasons:

  • Various Pthreads functions use thread IDs to identify the thread on which they are to act. Examples of such functions include pthread_join(), pthread_detach(), pthread_cancel(), and pthread_kill(), all of which we describe in this and the following chapters.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint