(unless there's a very short timeout).
Creating another thread to perform the blocking (calling WaitFor...) is the
recommended approach.
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"vi***@gmail.com" wrote:
Hi,
I have a forms application which hosts an unmanaged dll. This dll
exposes some simple c style functions which I just call using pinvoke.
But all native functions call WaitForMultiple\singleObject and wait
for a particular event to come. The problem is, this event can fire
only when messages on the windows message queue gets processed. Hence
if I call these blocking functions from native DLL directly from .NET
code they just block the application forever.
The solution I thought is to start a new thread and make this thread
call the dll method. I shall also create an event and pass its handle
into the thread created, so that this newly created thread can wait
for this event to happen. But then I would end up creating thread each
time for every native dll API call(every native DLL APi call does a
waitforsingle\multiple objects). This is not good..
Can anybody suggest a better design approach?
Regards,
Vishal.