/// <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)); }
public ReentrantFlagHandler(ReentrantFlag owner) { this.owner = owner; owner.flag = true; }