Windows 中的进程间信号量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6858652/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
inter-process semaphores in Windows
提问by yeap
采纳答案by yosh kemu
Look at the the help for CreateSemaphore() function: http://msdn.microsoft.com/en-us/library/ms682438(v=VS.85).aspxin the Remarks section, starting from "Multiple processes can handles....".
在 备注部分查看 CreateSemaphore() 函数的帮助:http: //msdn.microsoft.com/en-us/library/ms682438(v=VS.85) .aspx,从“多个进程可以处理。 ……”。
You'll find 3 cases there - all of them useful.
你会在那里找到 3 个案例——它们都很有用。
回答by Mike
Use CreateSemaphoreor CreateSemaphoreExto create a named semaphore. You can use the name to access the semaphore from other locations by calling CreateSemaphore
a second time.
使用CreateSemaphore或CreateSemaphoreEx创建命名信号量。您可以使用该名称通过CreateSemaphore
第二次调用从其他位置访问信号量。