开发者

small named shared-counter

开发者 https://www.devze.com 2023-03-22 03:31 出处:网络
I am looking at Windows synchronization objects http://msdn.microsoft.com/en-us/library/ms682411(v=VS.85).aspx, those that can be opened as named objects.

I am looking at Windows synchronization objects http://msdn.microsoft.com/en-us/library/ms682411(v=VS.85).aspx, those that can be opened as named objects.

Which objects can hold small amount (4-8 bytes) of shared info that san be Set by one process and Read by another process ? I realize shared memory does this, but it can be overkill with 4kb size pages and APIs that 开发者_开发技巧are longer than small APIs of synchronization objects.


Probably the most efficient method would be to use a message. It is rather ugly, however, as you must have a message pump. You can send a WM_USER or a registered message type to another thread via PostMessage to a window or PostThreadMessage to a thread.


Using hidden windows, you can use SetProp and GetProp functions

0

精彩评论

暂无评论...
验证码 换一张
取 消