Example #1
0
        public void waitUntilNotEqAndSet4()
        {
            Monitor <int?> m = new Monitor <int?>("a", null);

            Thread t = TestHelp.delayAndStart(200, new Thread(new ThreadStart(delegate()
            {
                m.Set(1);
            })));

            long t0 = HPTimer.Now();

            m.WaitUntilNotEqAndSet(null, 2);
            double t1 = (HPTimer.Now() - t0) / 1000000.0;

            TestHelp.AssertRelError(200, t1, REL_ERROR);

            t.Join();
        }
Example #2
0
        public void waitUntilEqAndSet4()
        {
            Monitor <int?> m = new Monitor <int?>("a", null);

            Thread t = TestHelp.delayAndStart(200, new Thread(new ThreadStart(delegate()
            {
                m.Set(1);
            })));

            long t0 = HPTimer.Now();

            m.WaitUntilEqAndSet(1, 2);
            double t1 = (HPTimer.Now() - t0) / 1000000.0;

            // TODO is there a better way for choosing relative error?
            TestHelp.AssertRelError(200, t1, REL_ERROR);

            t.Join();
        }