public void Mount(ref Thread thread) { Stack = thread.Stack.AddReference(); ExecutionQueue = thread.ExecutionQueue.AddReference(); PredicateResultQueue = thread.PredicateResultQueue?.AddReference() ?? thread.Parent?.PredicateResultQueue?.AddReference(); Parent = thread.Parent?.AddReference(); }
protected override void OnReleased() { Stack?.ReleaseReference(); ExecutionQueue?.ReleaseReference(); PredicateResultQueue?.ReleaseReference(); Parent?.ReleaseReference(); Stack = null; Parent = null; ExecutionQueue = null; base.OnReleased(); }
public void Dispose(Process process) { if (Parent == null) { Stack?.ReleaseReference(); ExecutionQueue?.ReleaseReference(); PredicateResultQueue?.ReleaseReference(); } else { if (ReferenceEquals(Stack, Parent.Stack) == false) { Stack?.ReleaseReference(); } if (ReferenceEquals(ExecutionQueue, Parent.ExecutionQueue) == false) { ExecutionQueue?.ReleaseReference(); } if (ReferenceEquals(PredicateResultQueue, Parent.PredicateResultQueue) == false) { PredicateResultQueue?.ReleaseReference(); } Parent.ReleaseReference(); } InstructionStream.UnlockPointer(InstructionPointer); StartExecutionQueue?.ReleaseReference(); InstructionStream.ReleaseReference(); process.Context.DisposeContextStateInternal(ContextState); DfaTrails = null; DfaTrailIndex = -1; Stack = null; Parent = null; ContextState = null; ExecutionQueue = null; InstructionStream = null; StartExecutionQueue = null; }