Using the thread message queue

As we said earlier, we can send a message to the thread without creating the window (UI). In our previous example, we were simply using the message queue created for the thread because it owns a window. Here, we will explain the ability to pass messages without using the window message queue.

Due to the simplicity of the example, we will send a message to the thread each time the user clicks on a button.

An analogy to such a task would be if we want to create an application that will display information about the weather forecast, we will have two threads: one is responsible for physical devices such as pressure meter, wind speed meter, and similar, while the other thread needs to wait for the data collected from the ...

Get C++ Multithreading Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.