System.Threading.ManualResetEventSlim.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            Dispose (true);
        }

Same methods

ManualResetEventSlim::Dispose ( bool disposing ) : void

Usage Example

Example #1
0
        public Evaluator(string jsShellPath, string options)
        {
            var psi = new ProcessStartInfo(
                jsShellPath, options
            ) {
                RedirectStandardInput = true,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                CreateNoWindow = true,
                UseShellExecute = false,
                WindowStyle = ProcessWindowStyle.Hidden
            };

            ManualResetEventSlim stdoutSignal, stderrSignal;
            stdoutSignal = new ManualResetEventSlim(false);
            stderrSignal = new ManualResetEventSlim(false);

            Process = Process.Start(psi);

            ThreadPool.QueueUserWorkItem((_) => {
                _StdOut = Process.StandardOutput.ReadToEnd();
                stdoutSignal.Set();
            });
            ThreadPool.QueueUserWorkItem((_) => {
                _StdErr = Process.StandardError.ReadToEnd();
                stderrSignal.Set();
            });

            _JoinImpl = () => {
                stdoutSignal.Wait();
                stderrSignal.Wait();
                stderrSignal.Dispose();
                stderrSignal.Dispose();
            };
        }
All Usage Examples Of System.Threading.ManualResetEventSlim::Dispose