public void Stop() { if (calculatorGraph == null) { return; } // TODO: not to call CloseAllPacketSources if calculatorGraph has not started. using (var status = calculatorGraph.CloseAllPacketSources()) { if (!status.ok) { Logger.LogError(TAG, status.ToString()); } } using (var status = calculatorGraph.WaitUntilDone()) { if (!status.ok) { Logger.LogError(TAG, status.ToString()); } } nameTable.Remove(calculatorGraph.mpPtr); calculatorGraph.Dispose(); calculatorGraph = null; if (stopwatch != null && stopwatch.IsRunning) { stopwatch.Stop(); } OnOutput.RemoveAllListeners(); }
public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed() { var graph = new CalculatorGraph(); graph.Dispose(); Assert.True(graph.isDisposed); }
public void Ctor_ShouldInstantiateCalculatorGraph_When_CalledWithNoArguments() { Assert.DoesNotThrow(() => { var graph = new CalculatorGraph(); graph.Dispose(); }); }
protected virtual void OnDestroy() { Stop(); if (graph != null) { graph.Dispose(); graph = null; } if (gpuHelper != null) { gpuHelper.Dispose(); gpuHelper = null; } }
protected virtual void OnDestroy() { Stop(); if (graph != null) { graph.Dispose(); graph = null; } gpuHelper = null; if (stopwatch != null && stopwatch.IsRunning) { stopwatch.Stop(); } }