المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Marshalling an AutoResetEvent to Unmanaged Code



C# Programming
10-05-2009, 02:22 PM
What is the proper way to marshal an AutoResetEvent to unmanaged code so that my native library can signal the event to unblock a managed thread?

Right now, I'm passing the AutoResetEvent unchanged through P/Invoke to the native library, and I'm hoping the CLR will hand over the OS handle, but the native code is getting error 6 - "The handle is invalid" when it tries to call SetEvent.