WaitForSingleObjectEx C# equivalent

  • Thread starter Thread starter Nadav
  • Start date Start date
N

Nadav

Hi,

I am using APC, this requires the usage of WaitForSingleObjectEx(... , ...
, true );
I want to use APC in C# What is the equivalent of WaitForSingleObjectEx in
C#?
**********************************************
* How should I implement the following section using C#? *
**********************************************
DWORD dwRetCode = WAIT_IO_COMPLETION;
while(WAIT_IO_COMPLETION == dwRetCode)
dwRetCode = WaitForSingleObjectEx(m_hWriting, INFINITE, TRUE);
**********************************************

Thanks,
Nadav.
 
Nadav,

In this case, you will have to make the call to WaitForSingleObjectEx
through the P/Invoke layer. The declaration you need is:

[DllImport("kernel32.dll", SetLastError=true)]
[return:MarshalAs(UnmanagedType.U4)]
public static int WaitForSingleObjectEx(
IntPtr hHandle,
[MarshalAs(UnmanagedType.U4)] int dwMilliseconds,
bool bAlertable);

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top