コード例 #1
0
        public void Can_stop()
        {
            var block = new ManualResetEvent(false);

            RegisterMetrics();

            ThreadPool.QueueUserWorkItem(
                s =>
            {
                var reporter = new ConsoleReporter();
                reporter.Start(1, TimeUnit.Seconds);
                reporter.Stopped += delegate { block.Set(); };
                Thread.Sleep(2000);
                reporter.Stop();
            });

            block.WaitOne();
        }