Groups | Blog | Home
all groups > dotnet compact framework > january 2006 >

dotnet compact framework : EventWaitHandle replace ManualResetEvent.WaitOne()



John Olbert
1/6/2006 7:37:02 PM
Can EventWaitHandle in OpenNetcf replace ManualResetEvent.WaitOne(
int millisecondsTimeout,bool exitContext)?

Thanks.

--
John Olbert
Sergey Bogdanov
1/7/2006 12:19:53 PM
Yes, it can.

EventWaitHandle ewh = new EventWaitHandle(false,
EventResetMode.ManualReset); // equals to ManualResetEvent


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


[quoted text, click to view]
John Olbert
1/7/2006 7:49:02 PM
One other question if possible. Is there a Netcf1.0 replacement for the
WaitAny() method below. I have searched the OpenNetcf. Also I found the C++
function in Ce called "int WaitForMultipleObjects(uint nCount, IntPtr[]
lpHandles, Int32 fWaitAll, uint dwMilliseconds);" which could be used to
construct the needed function. Unfortunately the lpHandles are not the
handles returned by ManualResetEvent.Handle. The WaitForMultipleObjects()
returns an error. The GetLastError() indicates invalid handle. Others on this
newsgroup have indicated that the ManualResetEvent.Handle is a pseudo-handle.

ManualResetEvent [] commands = { channelEvent, killEvent };
Int32 eventThatFired = WaitHandle.WaitAny(commands);

Any help would be appreciated.
--
John Olbert



[quoted text, click to view]
Sergey Bogdanov
1/8/2006 3:56:58 PM
You can use the EventWaitHandle.Handle instead. It contains the correct
Win32 handle which can be passed to WaitForMultipleObjects.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


[quoted text, click to view]
ctacke/
1/8/2006 5:10:39 PM
We've got it in SDF 2.0, the betas of which will be out this week.

-Chris


[quoted text, click to view]

AddThis Social Bookmark Button