EventLoopScheduler bug?


  • I think I found a bug in EventLoopScheduler. Here is a unit test which reproduces it:

    using System;
    using System.Threading;
    using NUnit.Framework;
    using System.Reactive.Concurrency;
    namespace EventLoopSchedulerTests {
        public class EventLoopSchedulerTests {
        public void TestEventLoopScheduler() {
          var scheduler = new EventLoopScheduler();
          scheduler.Schedule(TimeSpan.FromMinutes(1), () => { });
          scheduler.Schedule(TimeSpan.FromMinutes(2), () => { });

    If you run this unit test, one processor core will run on 100% for one minute.

    I looked with Reflector in the code and analysed it and I think the problem is that the ManualResetEvent is not reset if a second action is scheduled after the "current" one.

    Is this a known problem? Is there a workaround? Is it been fixed in 2.0?

    2. dubna 2012 6:02