public void SendRequest(Stopper stop) { if (pt != null) { pt.addRequest(stop); } }
private void Close(object obj) { Stopper.changeAllStop(); if (pt != null) { pt.Dispose(); } if (ctl != null) { for (int i = 0; i < CountConsumerThread; i++) { ctl[i].Dispose(); } } }
/* Function from the task specification*/ public static void ProcessRequest(Request request, Stopper stopSignal) { Random rnd = new Random(3000); int value = rnd.Next(); int i = 0; while (i <= value) { i++; if (stopSignal.IsStop) { break; } Thread.Sleep(1); } }
public static Request GetRequest(Stopper stopSignal) { Random rnd = new Random(3000); int value = rnd.Next(); int i = 0; while (i <= value) { i++; if (stopSignal.IsStop) { break; } Thread.Sleep(1); } return(stopSignal.IsStop ? null : (new Request())); }
private override void Run() { while (doing) { Request request = null; Stopper stop = null; if (QueueStop.CountQueue() != 0) { stop = QueueStop.RemoveQueue(); request = Request.GetRequest(stop); } else { Thread.Sleep(5000); } if (request != null && stop != null) { QueueCommon.AddQueue(new Element(stop, request)); } } }
public void addRequest(Stopper stop) { QueueStop.AddQueue(stop); }
public Element(Stopper _stopSignal, Request _request) { this.stopSignal = _stopSignal; this.request = _request; }