Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (45 sloc) 0.9 kB
#include "cThreadQueue.h"
namespace UOX
{
CThreadQueue messageLoop;
CThreadQueue::CThreadQueue()
{
}
CThreadQueue &CThreadQueue::operator<<( MessageType newMessage )
{
NewMessage( newMessage, NULL );
return (*this);
}
CThreadQueue &CThreadQueue::operator <<( char *toPush )
{
NewMessage( MSG_PRINT, toPush );
return (*this);
}
bool CThreadQueue::Empty( void )
{
MutexOn();
bool retVal = internalQueue.empty();
MutexOff();
return retVal;
}
MessagePassed CThreadQueue::GrabMessage( void )
{
MutexOn();
MessagePassed toReturn = internalQueue.front();
internalQueue.pop();
MutexOff();
return toReturn;
}
void CThreadQueue::NewMessage( MessageType toAdd, const char *data )
{
MutexOn();
MessagePassed adding;
adding.actualMessage = toAdd;
if( data == NULL )
adding.data[0] = 0;
else
strncpy( adding.data, data, 128 );
internalQueue.push( adding );
MutexOff();
}
}
Jump to Line
Something went wrong with that request. Please try again.