mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 21:33:59 +02:00
- added more info if we get mutex errors in the lobby
This commit is contained in:
@@ -72,6 +72,8 @@ private:
|
|||||||
SDL_mutex* mutex;
|
SDL_mutex* mutex;
|
||||||
int refCount;
|
int refCount;
|
||||||
string ownerId;
|
string ownerId;
|
||||||
|
string deleteownerId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mutex(string ownerId="");
|
Mutex(string ownerId="");
|
||||||
~Mutex();
|
~Mutex();
|
||||||
|
@@ -87,22 +87,24 @@ Mutex::Mutex(string ownerId) {
|
|||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL",__FILE__,__FUNCTION__,__LINE__);
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL",__FILE__,__FUNCTION__,__LINE__);
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
deleteownerId = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex::~Mutex() {
|
Mutex::~Mutex() {
|
||||||
if(mutex == NULL) {
|
if(mutex == NULL) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str());
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
//printf("%s\n",szBuf);
|
//printf("%s\n",szBuf);
|
||||||
}
|
}
|
||||||
else if(refCount >= 1) {
|
else if(refCount >= 1) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] about to destroy mutex refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] about to destroy mutex refCount = %d owner [%s] deleteownerId [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str());
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mutex != NULL) {
|
if(mutex != NULL) {
|
||||||
|
deleteownerId = ownerId;
|
||||||
SDL_DestroyMutex(mutex);
|
SDL_DestroyMutex(mutex);
|
||||||
mutex=NULL;
|
mutex=NULL;
|
||||||
}
|
}
|
||||||
@@ -111,7 +113,7 @@ Mutex::~Mutex() {
|
|||||||
void Mutex::p() {
|
void Mutex::p() {
|
||||||
if(mutex == NULL) {
|
if(mutex == NULL) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str());
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
SDL_mutexP(mutex);
|
SDL_mutexP(mutex);
|
||||||
@@ -121,7 +123,7 @@ void Mutex::p() {
|
|||||||
void Mutex::v() {
|
void Mutex::v() {
|
||||||
if(mutex == NULL) {
|
if(mutex == NULL) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str());
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
refCount--;
|
refCount--;
|
||||||
|
Reference in New Issue
Block a user