mirror of
https://github.com/glest/glest-source.git
synced 2025-09-26 07:28:59 +02:00
- attempt to improve issues in the custom menu related to freezing
- modified debug UI display to support multi levels of UI debug info - added more validations to mutexes - improved client sockets to properly be setup as non blocking
This commit is contained in:
@@ -77,8 +77,9 @@ void Thread::resume() {
|
||||
// Mutex
|
||||
// =====================================
|
||||
|
||||
Mutex::Mutex() {
|
||||
Mutex::Mutex(string ownerId) {
|
||||
refCount=0;
|
||||
this->ownerId = ownerId;
|
||||
mutex = SDL_CreateMutex();
|
||||
assert(mutex != NULL);
|
||||
if(mutex == NULL) {
|
||||
@@ -91,9 +92,15 @@ Mutex::Mutex() {
|
||||
Mutex::~Mutex() {
|
||||
if(mutex == NULL) {
|
||||
char szBuf[1024]="";
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
else if(refCount >= 1) {
|
||||
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());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
|
||||
SDL_DestroyMutex(mutex);
|
||||
mutex=NULL;
|
||||
}
|
||||
@@ -101,7 +108,7 @@ Mutex::~Mutex() {
|
||||
void Mutex::p() {
|
||||
if(mutex == NULL) {
|
||||
char szBuf[1024]="";
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
SDL_mutexP(mutex);
|
||||
@@ -111,7 +118,7 @@ void Mutex::p() {
|
||||
void Mutex::v() {
|
||||
if(mutex == NULL) {
|
||||
char szBuf[1024]="";
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s]",__FILE__,__FUNCTION__,__LINE__,refCount,ownerId.c_str());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
refCount--;
|
||||
|
Reference in New Issue
Block a user