1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| while (1) {
glfwLockMutex(mutex);
haveToQuit = mustDie;
glfwUnlockMutex(mutex);
if (haveToQuit) {
break;
}
glfwLockMutex(mutexStats); // un mutex static !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
boost::asio::streambuf sendBuff;
std::ostream send_stream(&sendBuff);
boost::archive::text_oarchive oTextArchive(send_stream);
pkInfo piS;
piS.type = pkInfo::PIT_NULL;
piS.nb = 0;
oTextArchive << piS;
// Send the request.
boost::asio::write(sock, sendBuff);
std::ostringstream oss;
// Read the response
boost::asio::streambuf readBuff;
boost::asio::read_until(sock, readBuff, "\0");
std::istream read_stream(&readBuff);
boost::archive::text_iarchive iTextArchive(read_stream);
pkInfo piR;
try {
iTextArchive >> piR; // LABEL IARCHIVE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
catch (...) {
log->log (Logger::IMPORTANT, "IAClient::routineDeIAClient", "exception betwen mutex");
}
glfwUnlockMutex(mutexStats); // ET le unlock !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fprintf (stdout, "after iArchive:%s\n", tbName.c_str());fflush (stdout);
glfwSleep(timeToSleep);
} |
Partager