开发者

.net EventWaitHandle in Inter-Process Context

开发者 https://www.devze.com 2022-12-28 20:15 出处:网络
when creating a named EventWaitHandle in each process you can specifiy in which state it should be. Now this somehow contradicts the assumption that the EventW开发者_如何学PythonaitHandle is usable fo

when creating a named EventWaitHandle in each process you can specifiy in which state it should be. Now this somehow contradicts the assumption that the EventW开发者_如何学PythonaitHandle is usable for IPC as another process might have set the state to "signalled" whereas I (when creating the EventWaitHandle) can set it to "not signalled".

Any ideas?

thanks, Chris


Did you read the documentation?

From the page:

When using this constructor for named system events, specify false for initialState. This constructor provides no way to determine whether a named system event was created, so you cannot make any assumptions about the state of the named event. To determine whether a named event was created, use the EventWaitHandle(Boolean, EventResetMode, String, Boolean) constructor or the EventWaitHandle(Boolean, EventResetMode, String, Boolean, EventWaitHandleSecurity) constructor.

If that is the constructor you're using, then the documentation for thaf constructor indicates that the initialState flag is only used when your call creates the event.

0

精彩评论

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