[Mono-dev] AutoResetEvent
Gwyneth Morrison
monogwyn at hotmail.com
Fri Oct 19 13:57:59 EDT 2007
Dear MONO Developers
We have an application written in C# for .NET 2.0, that needs to
communicate with a third party vendor's C++ DLL, which we do with a
brokering C++ DLL of our own.
Our.NETApp-->OurC++Connector.DLL-->ThirdPartyC++.DLL
The third party software is available in LINUX and in Windows, and is
formed to have an identical framework for any C++ calling app,
regardless of the OS it is running under.
The third party software runs a thread for alerting our C++ Connector,
that needs to queue up the message and allow the .NET app the ability to
pick it up later.
The .NET app creates an AutoReset event, and gets the OS handle to it
with the following calls.
int iNewEventHandle =
m_AutoResetEvent.SafeWaitHandle.DangerousGetHandle().ToInt32();
This unsigned int Handle, is then passed over the PInvoke interface to
OurC+++Connector.dll, that casts it back to a Windows HANDLE, and calls
SetEvent on it when a new message is received and queued from the third
party DLL.
This pattern of working has been very reliable in Windows, and we would
like to continue to follow this pattern under MONO.
We have assumed that the MONO library is using the PThread
implementation to support the .NET event model, so what we need to get
from MONO is the value of the event that we can then send to the PThread
library call to set the event to wake up the .NET Event Received thread
that is blocking.
How do we get this handle?
Gwyneth M
_________________________________________________________________
R U Ready for Windows Live Messenger Beta 8.5? Try it today!
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
More information about the Mono-devel-list
mailing list