none
EventLoopScheduler bug?

    Întrebare

  • 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 {
        [TestFixture]
        public class EventLoopSchedulerTests {
    
        [Test]
        public void TestEventLoopScheduler() {
          var scheduler = new EventLoopScheduler();
          scheduler.Schedule(TimeSpan.FromMinutes(1), () => { });
          Thread.Sleep(1000);
          scheduler.Schedule(TimeSpan.FromMinutes(2), () => { });
          Thread.Sleep(1000*60);
        }
      }
    }

    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 aprilie 2012 06:02

Răspunsuri

  • Known bug as mentioned in passing in the v2.0 Beta release notes. Will be fixed going forward.


    using (Microsoft.Sql.Cloud.DataProgrammability.Rx) { Signature.Emit("Bart De Smet"); }

    2 aprilie 2012 23:04
    Proprietar