Example #1
0
        /// <summary>
        /// Same as Enter, but if called after Enter (or self), return fake handler.
        /// This allows to check one flag many times, with only one reset at last dispose.
        /// </summary>
        /// <returns></returns>
        public ReentrantFlagHandler Join()
        {
            ReentrantFlag f;

            if (flag)
            {
                f = new ReentrantFlag();
            }
            else
            {
                f = this;
            }

            return(new ReentrantFlagHandler(f));
        }
Example #2
0
 public ReentrantFlagHandler(ReentrantFlag owner)
 {
     this.owner = owner;
     owner.flag = true;
 }