示例#1
0
        /// <summary>
        /// Release work item back to pool
        /// </summary>
        /// <param name="executor">Executor that owns the work item.</param>
        protected override void ReleaseToPool(ActivityExecutor executor)
        {
            this.ClearForReuse();

            _expressionActivity   = null;
            _instanceId           = 0;
            _resultLocation       = null;
            _nextArgumentWorkItem = null;

            executor.ExecuteSynchronousExpressionWorkItemPool.Release(this);
        }
示例#2
0
        /// <summary>
        /// Called each time a work item is acquired from the pool
        /// </summary>
        /// <param name="parentInstance">The ActivityInstance containin the variable or argument that contains this expression</param>
        /// <param name="expressionActivity">The expression to evaluate</param>
        /// <param name="instanceId">The ActivityInstanceID to use for expressionActivity</param>
        /// <param name="resultLocation">Location where the result of expressionActivity should be placed</param>
        /// <param name="nextArgumentWorkItem">WorkItem to execute after this one</param>
        public void Initialize(ActivityInstance parentInstance, ActivityWithResult expressionActivity, long instanceId, Location resultLocation, ResolveNextArgumentWorkItem nextArgumentWorkItem)
        {
            this.Reinitialize(parentInstance);

            Fx.Assert(resultLocation != null, "We should only use this work item when we are resolving arguments/variables and therefore have a result location.");
            Fx.Assert(expressionActivity.IsFastPath, "Should only use this work item for fast path expressions");

            _expressionActivity   = expressionActivity;
            _instanceId           = instanceId;
            _resultLocation       = resultLocation;
            _nextArgumentWorkItem = nextArgumentWorkItem;
        }