/// <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(); this.expressionActivity = null; this.instanceId = 0; this.resultLocation = null; this.nextArgumentWorkItem = null; executor.ExecuteSynchronousExpressionWorkItemPool.Release(this); }
/// <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"); this.expressionActivity = expressionActivity; this.instanceId = instanceId; this.resultLocation = resultLocation; this.nextArgumentWorkItem = nextArgumentWorkItem; }