Beispiel #1
0
		public Message Receive()
		{
			if (m_message == null)
			{
				return null;
			}

			m_mutex.Lock();
			try
			{
				Message msg = m_message;
				m_message = null;
				m_event.Reset();
				return msg;
			}
			finally
			{
				m_mutex.Unlock();
			}
		}
Beispiel #2
0
		internal void PutInto(Message message)
		{
			if (message == null)
			{
				throw new ArgumentNullException("message");
			}

			m_mutex.Lock();
			try
			{
				if (m_message != null)
				{
					throw new LetterBoxIsFullException();
				}
				m_message = message;
				m_event.Singal();
			}
			finally
			{
				m_mutex.Unlock();
			}
		}