mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 20:03:58 +02:00
- attempt to inline some mutex funcrtiosn for beter performance
This commit is contained in:
@@ -134,16 +134,16 @@ private:
|
|||||||
public:
|
public:
|
||||||
Mutex(string ownerId="");
|
Mutex(string ownerId="");
|
||||||
~Mutex();
|
~Mutex();
|
||||||
void setOwnerId(string ownerId) {
|
inline void setOwnerId(string ownerId) {
|
||||||
if(this->ownerId != ownerId) {
|
if(this->ownerId != ownerId) {
|
||||||
this->ownerId = ownerId;
|
this->ownerId = ownerId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void p();
|
void p();
|
||||||
void v();
|
void v();
|
||||||
int getRefCount() const { return refCount; }
|
inline int getRefCount() const { return refCount; }
|
||||||
|
|
||||||
SDL_mutex* getMutex() { return mutex; }
|
inline SDL_mutex* getMutex() { return mutex; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class MutexSafeWrapper {
|
class MutexSafeWrapper {
|
||||||
@@ -167,18 +167,18 @@ public:
|
|||||||
ReleaseLock();
|
ReleaseLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMutex(Mutex *mutex,string ownerId="") {
|
inline void setMutex(Mutex *mutex,string ownerId="") {
|
||||||
this->mutex = mutex;
|
this->mutex = mutex;
|
||||||
if(this->ownerId != ownerId) {
|
if(this->ownerId != ownerId) {
|
||||||
this->ownerId = ownerId;
|
this->ownerId = ownerId;
|
||||||
}
|
}
|
||||||
Lock();
|
Lock();
|
||||||
}
|
}
|
||||||
bool isValidMutex() const {
|
inline bool isValidMutex() const {
|
||||||
return(this->mutex != NULL);
|
return(this->mutex != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lock() {
|
inline void Lock() {
|
||||||
if(this->mutex != NULL) {
|
if(this->mutex != NULL) {
|
||||||
#ifdef DEBUG_MUTEXES
|
#ifdef DEBUG_MUTEXES
|
||||||
if(this->ownerId != "") {
|
if(this->ownerId != "") {
|
||||||
@@ -207,7 +207,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ReleaseLock(bool keepMutex=false,bool deleteMutexOnRelease=false) {
|
inline void ReleaseLock(bool keepMutex=false,bool deleteMutexOnRelease=false) {
|
||||||
if(this->mutex != NULL) {
|
if(this->mutex != NULL) {
|
||||||
#ifdef DEBUG_MUTEXES
|
#ifdef DEBUG_MUTEXES
|
||||||
if(this->ownerId != "") {
|
if(this->ownerId != "") {
|
||||||
|
Reference in New Issue
Block a user