MFC data forwarding to main thread via PostMessage

前端 未结 3 2022
时光取名叫无心
时光取名叫无心 2021-02-10 03:08

I have a C++/MFC application I need to restructure. The app used to process most of the data on the main thread, therefore blocking the input, and now I want to change it so, th

3条回答
  •  清歌不尽
    2021-02-10 04:01

    Use two queues, one for work requests going to the worker thread and one for results going back to the main thread. You can use PostMessage to wake up the main thread and tell it to check the queue, but you won't need any parameters in the message.

提交回复
热议问题