Exemplo n.º 1
0
 protected PerlaItem(Delegate action, object state, CancellationToken cancellationToken,
                     PerlaExcutionFlag excutionFlag, PerlaScheduler ItemScheduler)
 {
     this.m_action            = action;
     this.m_stateObject       = state;
     this.m_excutionFlag      = excutionFlag;
     this.m_ItemScheduler     = ItemScheduler;
     this.m_cancellationToken = cancellationToken;
 }
Exemplo n.º 2
0
        internal bool TryRunInline(PerlaItem item, bool taskWasPreviouslyQueued)
        {
            PerlaScheduler ets = item.ExecutingScheduler;

            if (ets != this && ets != null)
            {
                return(ets.TryRunInline(item, taskWasPreviouslyQueued));
            }
            if ((ets == null) ||
                (item.m_action == null) ||
                item.IsDelegateInvoked ||
                item.IsCanceled)
            {
                return(false);
            }
            bool inlined = TryExecuteTaskInline(item, taskWasPreviouslyQueued);

            if (inlined && !(item.IsDelegateInvoked || item.IsCanceled))
            {
                throw new InvalidOperationException("PerlaScheduler_InconsistentStateAfterTryExecuteTaskInline");
            }
            return(inlined);
        }