Пример #1
0
            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();
            }
Пример #2
0
            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;
                }
            }
Пример #3
0
            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;
                }
            }
Пример #4
0
 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();
 }