EventWaitHandle replace ManualResetEvent.WaitOne()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can EventWaitHandle in OpenNetcf replace ManualResetEvent.WaitOne(
int millisecondsTimeout,bool exitContext)?

Thanks.
 
Yes, it can.

EventWaitHandle ewh = new EventWaitHandle(false,
EventResetMode.ManualReset); // equals to ManualResetEvent
 
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



Sergey Bogdanov said:
Yes, it can.

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


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


John said:
Can EventWaitHandle in OpenNetcf replace ManualResetEvent.WaitOne(
int millisecondsTimeout,bool exitContext)?

Thanks.
 
You can use the EventWaitHandle.Handle instead. It contains the correct
Win32 handle which can be passed to WaitForMultipleObjects.
 
We've got it in SDF 2.0, the betas of which will be out this week.

-Chris


John Olbert said:
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



Sergey Bogdanov said:
Yes, it can.

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


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


John said:
Can EventWaitHandle in OpenNetcf replace ManualResetEvent.WaitOne(
int millisecondsTimeout,bool exitContext)?

Thanks.
 
Back
Top