Book Image

C++ Multithreading Cookbook

By : Miloš Ljumović
Book Image

C++ Multithreading Cookbook

By: Miloš Ljumović

Overview of this book

<p>Creating multithreaded applications is a present-day approach towards programming. With the power of C++, you can easily create various types of applications and perform parallelism and optimizations in your existing work. This book is a practical, powerful, and easy-to-understand guide to C++ multithreading. You will learn how to benefit from the multithreaded approach and enhance your development skills to build better applications. This book will not only help you avoid problems when creating parallel code, but also help you to understand synchronization techniques. The end goal of the book will be to impart various multithreading concepts that will enable you to do parallel computing and concurrent programming quickly and efficiently.</p>
Table of Contents (17 chapters)
C++ Multithreading Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Explaining the Windows Thread object


At the operating system level, a thread is an object created by the Object Manager. Like all the system objects, the thread has attributes (data) and methods (functions). The following table schematically shows the thread object and gives a list of its attributes and methods.

Most of the methods for threads have adequate Win32 API functions. For example, when we call SuspendThread, the Win32 subsystem calls the corresponding method Suspend. In other words, the Win32 API presents a method Suspend for the Win32 applications.

Windows has always protected some internal structures, such as windows or brushes of direct manipulation. Threads that are executed on a user level can't directly examine or modify the interior of the system object. It can only be done by calling the adequate Win32 API method that can do something with an object. Windows provides an identification code that identifies the object, while the programmers pass the identification code to the...