¿Es posible verificar cómo se trató en realidad el objeto AutoResetEvent
? ¿Se dispara por tiempo de espera o llamando a Set() desde otro método?Comprobar el estado AutoResetEvent
Aquí está mi código.
private AutoResetEvent autoResetEvent = new AutoResetEvent(false);
private int timeout = 30000;
public void SyncMethod()
{
// some code before
autoResetEvent.WaitOne(timeout);
// if autoResetEvent called by timeout then { do some stuff }
// some code after
}
public void AsyncMethod()
{
// some code before
// ok I am done
autoResetEvent.Set();
}
Tan fácil. :) ¡Gracias! –