ProcessLink.cpp
// Attempts to receive a message from the message stack. Returns true (and fills in the message)
//  if there is a message, false otherwise.
Attempts to receive a message from the message stack. Returns true (and fills in the message)
if there is a message, false otherwise.
Attempts to receive a message from the message stack . Returns true ( and fills in the message ) if there is a message false otherwise .
bool ProcessLink::ReceiveMessages(MessageData *pNewMessage)
{
    if (!receivedMessages.empty())
    {
        stackModificationMutex.lock();
        MessageData topMessage = receivedMessages.top();
        pNewMessage->messageData = topMessage.messageData;
        pNewMessage->messageLength = topMessage.messageLength;
        pNewMessage->messageType = topMessage.messageType;
        receivedMessages.pop();
        stackModificationMutex.unlock();
        return true;
    }
    return false;
}
bool ProcessLink :: ReceiveMessages ( MessageData * pNewMessage ) { if ( ! receivedMessages . empty ( ) ) { stackModificationMutex . lock ( ) ; MessageData topMessage = receivedMessages . top ( ) ; pNewMessage -> messageData = topMessage . messageData ; pNewMessage -> messageLength = topMessage . messageLength ; pNewMessage -> messageType = topMessage . messageType ; receivedMessages . pop ( ) ; stackModificationMutex . unlock ( ) ; return true ; } return false ; }
Attempts to receive a message from the message stack.
Attempts to receive a message from the message stack .
// There's only one reader, so we can do the empty check before locking/unlocking.