public Thread(ThreadParent parent, Node node, InstructionStream instructionStream, int instructionPointer, AutomataContextState contextState) : this() { CurrentNode = node; InstructionPointer = instructionPointer; ContextState = contextState; InstructionStream = instructionStream.AddReference(); InstructionStream.LockPointer(InstructionPointer); if (parent == null) { return; } Parent = parent; Parent.AddReference(); }
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; }