O'Reilly logo

Mastering C++ Programming by Jeganathan Swaminathan

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

How to compile and run

The following command helps compile the program:

g++ Thread.cpp main.cpp -std=c++17 -o threads.exe -lpthread

The output of the program will be as shown in the following screenshot:

Wow! We could start and stop the thread as designed and that too in an object-oriented fashion.

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