Skip to content

Commit

Permalink
[XrdSys] Ensure ABI compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jul 13, 2017
1 parent eee90c5 commit e4281e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 12 additions & 4 deletions src/XrdSut/XrdSutCache.hh
Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions src/XrdSys/XrdSysPthread.hh
Expand Up @@ -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);}

Expand Down

0 comments on commit e4281e2

Please sign in to comment.