Esempio n. 1
0
    public static void BlockOn(this ISemaphoreInterection semaphore, IBoolStateObserver source, IEventValidator eventValidation)
    {
        Action releaseAction = () => semaphore.Release(source);

        source.RegisterOnTrue(new ConditionalEventListener(() => semaphore.Block(source), eventValidation.CurrentValidationCheck));
        source.RegisterOnFalse(new ConditionalEventListener(releaseAction, eventValidation.CurrentValidationCheck));

        eventValidation.OnVoid.Register(new CallOnce(releaseAction));
    }
Esempio n. 2
0
 public static void BlockOn(this ISemaphoreInterection semaphore, IBoolStateObserver source, Func <bool> eventValidation)
 {
     source.RegisterOnTrue(new ConditionalEventListener(() => semaphore.Block(source), eventValidation));
     source.RegisterOnFalse(new ConditionalEventListener(() => semaphore.Release(source), eventValidation));
 }
Esempio n. 3
0
 public void ReleaseOn(IBoolStateObserver source, Func <bool> eventValidation)
 {
     source.RegisterOnTrue(new ConditionalEventListener(() => Release(source), eventValidation));
     source.RegisterOnFalse(new ConditionalEventListener(() => Block(source), eventValidation));
 }
Esempio n. 4
0
 public static void BlockOn(this ISemaphoreInterection semaphore, IBoolStateObserver source)
 {
     source.RegisterOnTrue(() => semaphore.Block(source));
     source.RegisterOnFalse(() => semaphore.Release(source));
 }
Esempio n. 5
0
 public void ReleaseOn(IBoolStateObserver source)
 {
     source.RegisterOnTrue(() => Release(source));
     source.RegisterOnFalse(() => Block(source));
 }