public void Dispose() { BlockedQueue queue; this.StopInvoker(); Monitor.Enter(queue = this.eventQueue); try { if (this.eventQueue == null) { return; } if ((this.eventQueue as IDisposable) == null) { return; } ((IDisposable)this.eventQueue).Dispose(); this.eventQueue = null; } catch (Exception ex) { ChatLog.GetInstance().LogException(ex); } finally { Monitor.Exit(queue); } if (base.Logger.IsDebugEnabled && this.thread != null) { base.Logger.Debug("SingleThreadInvoker [" + this.thread.Name + "] is disposing"); } }
public MySingleThreadInvoker(string name, int queueSize, ILogger myLog) { this.eventQueue = new BlockedQueue(); this.active = true; if (myLog == null) { this.eventQueue = new BlockedQueue(queueSize); this.StartThread(name); return; } base.EnableLogging(myLog); }