Ejemplo n.º 1
0
 private void Getbutler()
 {
     Console.WriteLine(Thread.CurrentThread.Name + ": butler, give me permission to eat!");
     _butler.Acquire();
     Console.WriteLine("\t" + Thread.CurrentThread.Name + ": Thank you, butler. I will now try to eat!");
     Thread.Sleep(_rand.Next(500, 1500));
 }
 /// <summary>
 /// En-queue to the BoundedChannel.
 /// </summary>
 /// <param name="data">
 /// Specifies the data to be en-queued to the BoundedChannel.
 /// </param>
 /// <exception cref="System.Threading.ThreadInterruptedException">
 /// Thrown when en-queueing is interrupted.
 /// </exception>
 public override void Enqueue(T data)
 {
     _upperBoundary.Acquire();
     base.Enqueue(data);
 }