예제 #1
0
    public void Dispose()
    {
        if (_disposed)
        {
            return;
        }

        SetHandle(NativeMethods.JobObjectLimitFlags.JOB_NONE);

        _handle.Close();
        _handle.Dispose();
        _handle   = null;
        _disposed = true;
    }
예제 #2
0
        public void Dispose()
        {
            if (m_disposed)
            {
                return;
            }

            try
            {
                if (Common.IsPosixEnvironment)
                {
                    foreach (WeakReference <Process> childProcessReference in m_childProcesses)
                    {
                        Process childProcess;

                        if (!childProcessReference.TryGetTarget(out childProcess))
                        {
                            continue;
                        }

                        try
                        {
                            childProcess.Kill();
                        }
                        catch (Exception ex)
                        {
                            TerminationException?.Invoke(this, new EventArgs <Exception>(ex));
                        }
                    }
                }

                m_jobHandle?.Dispose();
                m_jobHandle = null;
            }
            finally
            {
                m_disposed = true;
                GC.SuppressFinalize(this);
            }
        }
예제 #3
0
 public void Dispose() => handle.Dispose();