Ejemplo n.º 1
0
 ProductionPoint(ISequencerTaskRegister taskRegister,
                 ISequencerExceptionRegister exceptionRegister,
                 SeqPointTypeUC seqPointTypeUC,
                 object arg = null,
                 Action <object> injectContinuation = null)
 => SequencerStrategy.ProductionPoint(taskRegister, exceptionRegister, seqPointTypeUC, arg, injectContinuation)
 ;
Ejemplo n.º 2
0
        PointAsyncArg <TEnum, TArg>(this  ISequencerUC sequencer,
                                    SeqPointTypeUC seqPointTypeUC,
                                    TEnum registration,
                                    Func <bool> condition,
                                    TArg arg,
                                    Action <object> injectContinuation = null)
            where TEnum : struct
        {
            SequencerRegisterUC register = sequencer as SequencerRegisterUC;

            if (register == null || condition == null || !condition())
            {
                return(CompletedAwaiter);
            }

            ISequencerExceptionRegister exceptionRegister = register.ExceptionRegister.TryReThrowException();
            ISequencerTaskRegister      taskRegister      = register.TaskRegister;

            ISequencerPointUC <TEnum> seqPoint = register.TryGet(registration);

            return
                (seqPoint?.ProductionPoint(taskRegister, exceptionRegister, seqPointTypeUC, arg, injectContinuation)
                 ?? CompletedAwaiter
                );
        }
Ejemplo n.º 3
0
        public ProductionPointUC(ISequencerTaskRegister taskRegister,
                                 ISequencerExceptionRegister exceptionRegister,
                                 SeqPointTypeUC seqPointType,
                                 object productionArg = null,
                                 Action <object> injectContinuation = null)
        {
            SeqPointType      = seqPointType;
            ProductionArg     = productionArg;
            TaskRegister      = taskRegister;
            ExceptionRegister = exceptionRegister;

            if (SeqPointType == SeqPointTypeUC.Match)
            {
                InjectContinuation = injectContinuation;
                ExecutionContext   = InjectContinuation != null?ExecutionContext.Capture() : null;

                SynchronizationContext = InjectContinuation != null ? SynchronizationContext.Current : null;
                TaskScheduler          = InjectContinuation != null && SynchronizationContext == null ? TaskScheduler.Current : null;
                return;
            }

            if (SeqPointType == SeqPointTypeUC.Notify)
            {
                Complete();
            }

            exceptionRegister.Token.Register(OnCancel);
        }
Ejemplo n.º 4
0
        TestPointAsync <TEnum>(this ISequencerUC sequencer, TEnum registration)
            where TEnum : struct
        {
            if (!(sequencer is SequencerRegisterUC register))
            {
                return(TestPointUC.EmptyCompleted);
            }

            ISequencerExceptionRegister exceptionRegister = register.ExceptionRegister.TryReThrowException();
            ISequencerTaskRegister      taskRegister      = register.TaskRegister;

            ISequencerPointUC <TEnum> seqPoint = register.TryGet(registration);

            return
                (seqPoint?.TestPoint(taskRegister, exceptionRegister) ??
                 TestPointUC.EmptyCompleted
                );
        }
        TestPoint(ISequencerTaskRegister taskRegister,
                  ISequencerExceptionRegister exceptionRegister)
        {
            TestPointUC        testPoint       = new TestPointUC(taskRegister, exceptionRegister);
            IProductionPointUC productionMatch = null;
            ITestPointUC       testMatch       = null;

            using (Lock.Enter())
            {
                TestPointQueue.Enqueue(testPoint);
                if (ProductionPointQueue.Count > 0 && TestPointQueue.Count > 0)
                {
                    productionMatch = ProductionPointQueue.Dequeue();
                    testMatch       = TestPointQueue.Dequeue();
                }
            }
            testMatch?.Complete(productionMatch);
            return(testPoint);
        }
        ProductionPoint(ISequencerTaskRegister taskRegister,
                        ISequencerExceptionRegister exceptionRegister,
                        SeqPointTypeUC seqPointTypeUC,
                        object arg = null,
                        Action <object> injectContinuation = null)
        {
            ProductionPointUC  productionPoint = new ProductionPointUC(taskRegister, exceptionRegister, seqPointTypeUC, arg, injectContinuation);
            IProductionPointUC productionMatch = null;
            ITestPointUC       testMatch       = null;

            using (Lock.Enter())
            {
                ProductionPointQueue.Enqueue(productionPoint);
                if (ProductionPointQueue.Count > 0 && TestPointQueue.Count > 0)
                {
                    productionMatch = ProductionPointQueue.Dequeue();
                    testMatch       = TestPointQueue.Dequeue();
                }
            }
            testMatch?.Complete(productionMatch);
            return(productionPoint);
        }
Ejemplo n.º 7
0
 TestPoint(ISequencerTaskRegister taskRegister,
           ISequencerExceptionRegister exceptionRegister)
 => SequencerStrategy.TestPoint(taskRegister, exceptionRegister)
 ;
Ejemplo n.º 8
0
 public SequencerTaskRegister(ISequencerUC sequencerUC, ISequencerExceptionRegister exceptionRegister)
 {
     SequencerUC       = sequencerUC;
     ExceptionRegister = exceptionRegister;
 }
Ejemplo n.º 9
0
 public TestPointUC(ISequencerTaskRegister taskRegister, ISequencerExceptionRegister exceptionRegister)
 {
     TaskRegister      = taskRegister;
     ExceptionRegister = exceptionRegister;
     exceptionRegister.Token.Register(OnCancel);
 }