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
Share this Page URL
Help

Chapter 5. Using POSIX Threads > Creating Threads

Creating Threads

An application initially starts with a single thread, which is often referred to as the main thread or the master thread. Calling pthread_create() creates a new thread. It takes the following parameters:

  • A pointer to a pthread_t structure. The call will return the handle to the thread in this structure.

  • A pointer to a pthread attributes structure, which can be a null pointer if the default attributes are to be used. The details of this structure will be discussed later.

  • The address of the routine to be executed.

  • A value or pointer to be passed into the new thread as a parameter.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

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

  

Start a Free Trial


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