mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 23:21:19 +02:00
- Attempt to use libcurl in a thread safe manner
This commit is contained in:
@@ -33,7 +33,7 @@ BaseThread::BaseThread() : Thread() {
|
||||
BaseThread::~BaseThread() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
shutdownAndWait();
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
}
|
||||
|
||||
void BaseThread::signalQuit() {
|
||||
@@ -98,20 +98,20 @@ void BaseThread::shutdownAndWait(BaseThread *pThread) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
|
||||
pThread->signalQuit();
|
||||
sleep(0);
|
||||
//sleep(0);
|
||||
|
||||
for( time_t elapsed = time(NULL); difftime(time(NULL),elapsed) <= 7; ) {
|
||||
for( time_t elapsed = time(NULL); difftime(time(NULL),elapsed) <= 5; ) {
|
||||
if(pThread->getRunningStatus() == false) {
|
||||
break;
|
||||
}
|
||||
sleep(0);
|
||||
sleep(1);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
//sleep(0);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
}
|
||||
//sleep(0);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
|
||||
}
|
||||
|
||||
void BaseThread::shutdownAndWait() {
|
||||
|
@@ -145,7 +145,7 @@ void SimpleTaskThread::execute() {
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
|
||||
setRunningStatus(false);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s] END\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
|
||||
}
|
||||
|
||||
void SimpleTaskThread::setTaskSignalled(bool value) {
|
||||
|
@@ -708,6 +708,7 @@ float Socket::getThreadedPingMS(std::string host) {
|
||||
if(pingThread == NULL) {
|
||||
lastThreadedPing = 0;
|
||||
pingThread = new SimpleTaskThread(this,0,50);
|
||||
pingThread->setUniqueID(__FILE__ + "_" + __FUNCTION);
|
||||
pingThread->start();
|
||||
}
|
||||
|
||||
@@ -1216,6 +1217,7 @@ void ClientSocket::startBroadCastClientThread(DiscoveredServersInterface *cb) {
|
||||
ClientSocket::stopBroadCastClientThread();
|
||||
|
||||
broadCastClientThread = new BroadCastClientSocketThread(cb);
|
||||
broadCastClientThread->setUniqueID(string(__FILE__) + string("_") + string(__FUNCTION__));
|
||||
broadCastClientThread->start();
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
@@ -1495,6 +1497,7 @@ void ServerSocket::startBroadCastThread() {
|
||||
stopBroadCastThread();
|
||||
|
||||
broadCastThread = new BroadCastSocketThread();
|
||||
broadCastThread->setUniqueID(string(__FILE__) + string("_") + string(__FUNCTION__));
|
||||
broadCastThread->start();
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
Reference in New Issue
Block a user