docs: public Message receiveMessage()
      {
          while ((m_stack != null) && (m_stack.isEmpty()))
          {
              m_thread = Thread.currentThread();
              synchronized(m_thread)
              {
                  m_bWaiting = true;
                  if (m_stack.isEmpty())      // In case a message was added outside the sync block.
                  {
                      try {
                          m_thread.wait();
                      } catch (InterruptedException ex)   {
                          m_stack = null; // This causes a null message to return, which tells the receiving loop to stop (halting this thread).
                          m_thread = null;    // Don't free this twice.
                      }
                  }
                  m_bWaiting = false;     // Notified
              }
          }
          Message message = null;
          if (m_stack != null)
              if (!m_stack.isEmpty())
                  message = m_stack.remove(0);
          return message;
      }