that is the blocking code, how would I convert it to non blocking async ? I'm trying to do async communication between a client and a server. here is my blocking sync code, how would I do it async ?
bool S3W::CImplServerData::WaitForCompletion(unsigned int timeout)
{
unsigned int t1;
while (true)
{
BinaryMessageBuffer currBuff;
if (m_Queue.try_pop(currBuff))
{
ProcessBuffer(currBuff);
t1 = clock();
}
else
{
unsigned int t2 = clock();
if ((t2 - t1) > timeout)
{
return false;
}
else
{
Sleep(1);
}
}
}
return true;
}