This project has moved. For the latest updates, please go here.
1
Vote

DoSynchronously with timeout parameter may dispose the MRE before the queued action Sets it

description

In this code
 
    public bool DoSynchronously(Action action, TimeSpan timeout)
    {
        Contract.Requires(action != null);
        using (var evt = new ManualResetEvent(false))
        {
           this.dispatcher.QueueAction(() => { action(); evt.Set(); });
           return evt.WaitOne(timeout);
        }
    }
 
the event could timeout and be disposed before the dispatcher thread sets it in the delegate.
 
You don't appear to have any unit tests for DoSynchronously.
 
thanks

comments