我移植 C ++ API
code到 .NET
,展望函数调用 WaitHandle.WaitAny
来替代 WaitForMultipleObjects的
但 .NET4 我可以看到,这个函数挂钩到
I am porting C++ API
code to .NET
and looking into function call WaitHandle.WaitAny
as a replacement for WaitForMultipleObjects
but when debugging with .NET4
i can see that this function is hooked into
private static extern int WaitMultiple(
WaitHandle[] waitableSafeHandle,
int msTimeOut,
bool exitContext,
bool WaitAll);
这让我觉得,这个功能是不是sutable的端口。任何其他建议?
and this makes me think that this function is not sutable for the port. Any other suggestions?
这是事实, WaitHandle.WaitAny()
不是很够,以匹配 WaitForMultipleObjects的()。但是,你只需要使用 WaitHandle.WaitAll的()
和
It is true that WaitHandle.WaitAny()
is not quite enough to match the functionality of WaitForMultipleObjects()
. But you just need to use WaitHandle.WaitAll()
as well.
WaitHandle.WaitAny()
匹配 WaitForMultipleObjects的()
调用,使用为WaitAll
参数设置为 FALSE
。
WaitHandle.WaitAll的()
与为WaitAll
匹配其设置为 TRUE
。
WaitHandle.WaitAny()
matches WaitForMultipleObjects()
called with the WaitAll
parameter set to FALSE
,.
WaitHandle.WaitAll()
matches it with WaitAll
set to TRUE
.