Beispiel #1
0
 /// <summary>
 /// Send a message to the channel with unlimited timeout.
 /// </summary>
 /// <param name="item">The object to send. Only objects masked with the <see cref="System.SerializableAttribute"/> are allowed to be transfered through this channel.</param>
 /// <remarks>This member is thread-safe.</remarks>
 public void Send(object item)
 {
     try { empty.Acquire(); }
     catch (System.Threading.ThreadInterruptedException e)
     {
         DumpItemSynchronized(item);
         throw e;
     }
     try { mutex.Acquire(); }
     catch (System.Threading.ThreadInterruptedException e)
     {
         DumpItemSynchronized(item);
         empty.Release();
         throw e;
     }
     queue.Enqueue();
     try { queue.WriteSerialize(item, 0); }
     catch (Exception e)
     {
         queue.RollbackEnqueue();
         mutex.Release();
         empty.Release();
         throw e;
     }
     mutex.Release();
     full.Release();
 }
 /// <summary>
 /// Block until another thread calls the same method.
 /// </summary>
 public void RendezVous()
 {
     remote.Release();
     local.Acquire();
 }