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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:38:07  来源:igfitidea点击:

inter-process semaphores in Windows

windowssemaphore

提问by yeap

is there any kind of semaphore for processes in Windows API? I found this one

Windows API 中的进程是否有任何类型的信号量?我找到了这个

but it is only for thread as I understood, thanks in advance for any help

但这仅适用于我所理解的线程,在此先感谢您的帮助

采纳答案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 CreateSemaphorea second time.

使用CreateSemaphoreCreateSemaphoreEx创建命名信号量。您可以使用该名称通过CreateSemaphore第二次调用从其他位置访问信号量。