Beispiel #1
0
        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();
        }
Beispiel #2
0
        public void IsDisposed_ShouldReturnTrue_When_AlreadyDisposed()
        {
            var graph = new CalculatorGraph();

            graph.Dispose();

            Assert.True(graph.isDisposed);
        }
Beispiel #3
0
 public void Ctor_ShouldInstantiateCalculatorGraph_When_CalledWithNoArguments()
 {
     Assert.DoesNotThrow(() =>
     {
         var graph = new CalculatorGraph();
         graph.Dispose();
     });
 }
Beispiel #4
0
 protected virtual void OnDestroy()
 {
     Stop();
     if (graph != null)
     {
         graph.Dispose();
         graph = null;
     }
     if (gpuHelper != null)
     {
         gpuHelper.Dispose();
         gpuHelper = null;
     }
 }
Beispiel #5
0
    protected virtual void OnDestroy()
    {
        Stop();

        if (graph != null)
        {
            graph.Dispose();
            graph = null;
        }

        gpuHelper = null;

        if (stopwatch != null && stopwatch.IsRunning)
        {
            stopwatch.Stop();
        }
    }