O'Reilly logo

Windows® via C/C++, Fifth Edition by Christophe Nasarre, Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Some Thread Internals

So far, I’ve explained how to implement a thread function and how to have the system create a thread to execute that function. In this section, we’ll look at how the system pulls this off.

Figure 6-1 shows what the system must do to create and initialize a thread.

How a thread is created and initialized

Figure 6-1. How a thread is created and initialized

Let’s look closely at this figure to understand exactly what’s going on. A call to CreateThread causes the system to create a thread kernel object. This object has an initial usage count of 2. (The thread kernel object is not destroyed until the thread stops running and the handle returned from CreateThread is closed.) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required