Is there was a mechanism in Windows works like message queue in Linux?

后端 未结 1 694
耶瑟儿~
耶瑟儿~ 2020-12-19 18:48

Recently, I got a job(C/C++) to use message communication between different threads in Windows. I Googled and find that the Windows also got a message queue too, but it is m

相关标签:
1条回答
  • 2020-12-19 19:23

    You don't need a window to use messages on Windows, any thread that calls PeekMessage or GetMessage gets a message queue and you can post messages to it with PostThreadMessage.

    Messages should work fine in the same process but if this is cross-process and you need to send more than size_t*2 you should look at other IPC mechanisms or build your own with shared memory and some type of locking. Windows also has MSMQ.

    You did not specify if you need the exact POSIX interface or not, either way, Wikipedia has a list of open source alternatives...

    0 讨论(0)
提交回复
热议问题