Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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;
            }
        }