protected override void Producer() { Event asynchronousEvent = new OutputEvent(new TestOutput(string.Empty, TestOutputType.Trace)); Assert.IsFalse(asynchronousEvent.IsSynchronous); this.q.Enqueue(asynchronousEvent); this.afterEnqueue = true; Thread.MemoryBarrier(); }
private void Produce() { try { Event e = new OutputEvent(new TestOutput(this.ProducerThread.Name, TestOutputType.Log)); DateTime start = DateTime.Now; while (DateTime.Now - start <= TimeSpan.FromSeconds(3)) { this.queue.Enqueue(e); this.SentEventsCount++; this.MaxQueueLength = Math.Max(this.queue.Count, this.MaxQueueLength); // without Sleep or with just a Sleep(0), the EventPump thread does not keep up and the queue gets very long if (this.delay) { Thread.Sleep(1); } } } catch (Exception ex) { this.Exception = ex; } }
private void Produce() { try { Event e = new OutputEvent(new TestOutput(this.ProducerThread.Name, TestOutputType.Log)); DateTime start = DateTime.Now; while (DateTime.Now - start <= TimeSpan.FromSeconds(3)) { this.queue.Enqueue(e); this.SentEventsCount++; this.MaxQueueLength = Math.Max(this.queue.Count, this.MaxQueueLength); // without Sleep or with just a Sleep(0), the EventPump thread does not keep up and the queue gets very long if (this.delay) { Thread.Sleep(1); } } } catch (Exception ex) { this.Exception = ex; } }
protected override void Producer() { Event asynchronousEvent = new OutputEvent(new TestOutput(string.Empty, TestOutputType.Trace)); Assert.IsFalse(asynchronousEvent.IsSynchronous); this.q.Enqueue(asynchronousEvent); this.afterEnqueue = true; Thread.MemoryBarrier(); }