public string displayName;
public string displayUnits;
public int callbackCount;
+ public ManualResetEvent sawEvent;
public SimpleEventListener(string targetSourceName, EventLevel level)
{
means = new HashSet<int>();
args = new Dictionary<string, string>();
args.Add("EventCounterIntervalSec", "1");
+ sawEvent = new ManualResetEvent(false);
}
protected override void OnEventSourceCreated(EventSource source)
}
}
}
+ sawEvent.Set();
callbackCount++;
}
}
public static int Main(string[] args)
{
+
// Create an EventListener.
using (SimpleEventListener myListener = new SimpleEventListener("SimpleEventSource", EventLevel.Verbose))
{
eventSource.WriteOne();
}
- Thread.Sleep(3000);
+ myListener.sawEvent.WaitOne(-1); // Block until we see at least one event
if (!myListener.validateMean())
{