diff --git a/src/XrdSut/XrdSutCache.hh b/src/XrdSut/XrdSutCache.hh index 48643f60f12..d24415c2108 100644 --- a/src/XrdSut/XrdSutCache.hh +++ b/src/XrdSut/XrdSutCache.hh @@ -70,7 +70,9 @@ public: // We found an existing entry: // lock until we get the ability to read (another thread may be valudating it) - if (cent->rwmtx.ReadLock()) { + int status = 0; + cent->rwmtx.ReadLock( status ); + if ( status ) { // A problem occured: fail (set the entry invalid) cent->status = kCE_inactive; } @@ -95,7 +97,9 @@ public: if (!(cent = table.Find(tag))) { // If none, create a new one and write-lock for validation cent = new XrdSutCacheEntry(tag); - if (cent->rwmtx.WriteLock()) { + int status = 0; + cent->rwmtx.WriteLock( status ); + if (status) { // A problem occured: delete the entry and fail delete cent; return (XrdSutCacheEntry *)0; @@ -107,7 +111,9 @@ public: // We found an existing entry: // lock until we get the ability to read (another thread may be valudating it) - if (cent->rwmtx.ReadLock()) { + int status = 0; + cent->rwmtx.ReadLock( status ); + if (status) { // A problem occured: fail (set the entry invalid) cent->status = kCE_inactive; return cent; @@ -121,7 +127,9 @@ public: } else { // Invalid entry: unlock and write-lock to be able to validate it cent->rwmtx.UnLock(); - if (cent->rwmtx.WriteLock()) { + int status = 0; + cent->rwmtx.WriteLock( status ); + if (status) { // A problem occured: fail (set the entry invalid) cent->status = kCE_inactive; return cent; diff --git a/src/XrdSys/XrdSysPthread.hh b/src/XrdSys/XrdSysPthread.hh index 9217fdc3d3a..6de3c5d9b29 100644 --- a/src/XrdSys/XrdSysPthread.hh +++ b/src/XrdSys/XrdSysPthread.hh @@ -234,8 +234,11 @@ inline int CondWriteLock() return 1; } -inline int ReadLock() {return pthread_rwlock_rdlock(&lock);} -inline int WriteLock() {return pthread_rwlock_wrlock(&lock);} +inline void ReadLock() {pthread_rwlock_rdlock(&lock);} +inline void WriteLock() {pthread_rwlock_wrlock(&lock);} + +inline void ReadLock( int &status ) {status = pthread_rwlock_rdlock(&lock);} +inline void WriteLock( int &status ) {status = pthread_rwlock_wrlock(&lock);} inline void UnLock() {pthread_rwlock_unlock(&lock);}