/// <summary> /// Initializes this queue helper. /// </summary> /// <param name="reportDelegate">Method to handle incoming chat events.</param> public QueueHelper(QueueHelperDelegate <T> reportDelegate = null) { if (reportDelegate != null) { this.SetReportDelegate(reportDelegate); } }
/// <summary> /// Initializes this queue helper. /// </summary> /// <param name="reportDelegate">Method to handle incoming chat events.</param> public QueueHelper(QueueHelperDelegate <T> reportDelegate = null, SimpleLogger.Logger logger = null) { this.log = logger; if (reportDelegate != null) { this.SetReportDelegate(reportDelegate); } }
protected virtual void Dispose(bool managed) { if (!managed) { return; } this.disposed = true; this.incEventQueue.Dispose(); this.reportDelegate = null; }
/// <summary> /// Defines a delegate which will be executed on the worker thread for each item in the queue. /// </summary> /// <param name="reportDelegate"></param> protected void SetReportDelegate(QueueHelperDelegate <T> reportDelegate, string tag = "") { if (this.disposed) { throw new ObjectDisposedException("QueueHelper"); } if (this.reportDelegate != null) { } this.reportDelegate = reportDelegate; this.incEventThread = new Thread(new ThreadStart(this.EventPuller)); this.incEventThread.IsBackground = true; this.incEventThread.Name = "HandsoffHelper->EventPuller() (" + tag + ")"; this.incEventThread.Start(); }