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 6. Windows Threading > Creating Native Windows Threads

Creating Native Windows Threads

A basic Windows application will start with a single thread. The function call to request that Windows create a child thread is CreateThread(). This call takes the parameters shown in Table 6.1.

Table 6.1. Parameters Passed to CreateThread()
Parameter TypeComment
LPTHREADATTRIBUTESThe security attributes of the thread; a discussion of this is outside the scope of this text. However, passing zero will suffice for the purposes of creating child threads.
SIZE_TThe stack size for the thread. The default is for each thread to get 1MB of stack space. A thread created using a POSIX API would have its stack size provided by a separate attributes structure.
LPTHREAD_START_ROUTINEThe address of the function that the thread will execute.
LPVOIDThe parameters that are to be passed to the thread.
DWORDWhether the thread should be created in a suspended state. A suspended thread needs to be started by a call to the ResumeThread() function.
LPDWORDA pointer to a variable where the thread ID can be written.



  

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