protected virtual void Dispose(bool disposing) { if (!disposing || DisposeFlag.IsFirstCall() == false) { return; } if (this.Worker != null) { Worker.ExecAsync(p => { MutantBase._DisposeSafe(); }, 0); Worker._DisposeSafe(); } this.Leak._DisposeSafe(); }
public Mutant(string name, bool nonBlock, bool selfThread) { this.Name = name; this.NonBlock = nonBlock; this.Leak = LeakChecker.Enter(LeakCounterKind.Mutant); try { Worker = new SingleThreadWorker($"Mutant - '{this.Name}'", selfThread); Worker.ExecAsync(p => { MutantBase = MutantBase.Create(name); }, 0)._GetResult(); } catch { this._DisposeSafe(); throw; } }