コード例 #1
0
        public void TestOneshotFlag()
        {
            var val = new AutoResetFlag(true);

            Assert.IsTrue(val.Peek());
            Assert.IsTrue(val.Read());
            Assert.IsTrue(!val.Peek());
            Assert.IsTrue(!val.Read());
            Assert.IsTrue(!val.Peek());
            val.Set();
            Assert.IsTrue(val.Peek());
            Assert.IsTrue(val.Read());
            Assert.IsTrue(!val.Peek());
            Assert.IsTrue(!val.Read());
            Assert.IsTrue(!val.Peek());

            val = new AutoResetFlag(false);
            Assert.IsTrue(!val.Peek());
            Assert.IsTrue(!val.Read());
            Assert.IsTrue(!val.Peek());
            val.Set();
            Assert.IsTrue(val.Peek());
            Assert.IsTrue(val.Read());
            Assert.IsTrue(!val.Peek());
            Assert.IsTrue(!val.Read());
            Assert.IsTrue(!val.Peek());
        }
コード例 #2
0
 /// <summary>
 /// Create a new builder with the defined scope
 /// </summary>
 /// <param name="scope"></param>
 public RegexBuilder(RegexScope scope = RegexScope.Anywhere)
 {
     this.negate = new AutoResetFlag(false);
     this.scope  = scope;
 }