Hi. I have a 3rd party COM object I call that uses a event callback to signal it has completed its task.
obj.Start();
then sometime later it will raise an event to say it is done.
void OperationFinished()
I would like to be able to do this operation synchronously and have tried to use AutoResetEvents to handle this
e.g.
obj.Start();
m_autoReset.WaitOne();
and in the event handler:
void OperationFinished()
{
m_autoReset.Set();
}
but it seems that both the Set() and the WaitOne() are on the same thread so it gets stuck. Is there a simple way to handle this?