XRootD
XrdSysRWLock Class Reference

#include <XrdSysPthread.hh>

+ Collaboration diagram for XrdSysRWLock:

Public Types

enum  PrefType { prefWR =1 }
 

Public Member Functions

 XrdSysRWLock ()
 
 XrdSysRWLock (PrefType)
 
 ~XrdSysRWLock ()
 
int CondReadLock ()
 
int CondWriteLock ()
 
void ReadLock ()
 
void ReadLock (int &status)
 
void ReInitialize ()
 
void ReInitialize (PrefType)
 
void UnLock ()
 
void WriteLock ()
 
void WriteLock (int &status)
 

Protected Attributes

pthread_rwlock_t lock
 

Detailed Description

Definition at line 329 of file XrdSysPthread.hh.

Member Enumeration Documentation

◆ PrefType

Enumerator
prefWR 

Definition at line 350 of file XrdSysPthread.hh.

350 {prefWR=1};

Constructor & Destructor Documentation

◆ XrdSysRWLock() [1/2]

XrdSysRWLock::XrdSysRWLock ( PrefType  )
inline

Definition at line 352 of file XrdSysPthread.hh.

353  {
354 #if defined(__linux__) && (defined(__GLIBC__) || defined(__UCLIBC__))
355  pthread_rwlockattr_t attr;
356  pthread_rwlockattr_setkind_np(&attr,
357  PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
358  pthread_rwlock_init(&lock, &attr);
359 #else
360  pthread_rwlock_init(&lock, NULL);
361 #endif
362  }
pthread_rwlock_t lock

References lock.

◆ XrdSysRWLock() [2/2]

XrdSysRWLock::XrdSysRWLock ( )
inline

Definition at line 364 of file XrdSysPthread.hh.

364 {pthread_rwlock_init(&lock, NULL);}

References lock.

◆ ~XrdSysRWLock()

XrdSysRWLock::~XrdSysRWLock ( )
inline

Definition at line 365 of file XrdSysPthread.hh.

365 {pthread_rwlock_destroy(&lock);}

References lock.

Member Function Documentation

◆ CondReadLock()

int XrdSysRWLock::CondReadLock ( )
inline

Definition at line 333 of file XrdSysPthread.hh.

334  {if (pthread_rwlock_tryrdlock( &lock )) return 0;
335  return 1;
336  }

References lock.

Referenced by XrdPosixObject::Dir(), and XrdPosixObject::File().

+ Here is the caller graph for this function:

◆ CondWriteLock()

int XrdSysRWLock::CondWriteLock ( )
inline

Definition at line 337 of file XrdSysPthread.hh.

338  {if (pthread_rwlock_trywrlock( &lock )) return 0;
339  return 1;
340  }

References lock.

Referenced by XrdPosixObject::Dir(), and XrdPosixObject::File().

+ Here is the caller graph for this function:

◆ ReadLock() [1/2]

void XrdSysRWLock::ReadLock ( )
inline

Definition at line 342 of file XrdSysPthread.hh.

342 {pthread_rwlock_rdlock(&lock);}

References lock.

Referenced by XrdSysRWLockHelper::XrdSysRWLockHelper(), XrdTlsFlush::Flusher(), XrdSutCache::Get(), XrdPosixObject::Lock(), XrdSysRWLockHelper::Lock(), XrdCmsNode::n2gLock(), XrdSutCERef::ReadLock(), XrdTlsCrl::Refresh(), XrdTlsContext::Session(), and XrdCmsCluster::SLock().

+ Here is the caller graph for this function:

◆ ReadLock() [2/2]

void XrdSysRWLock::ReadLock ( int &  status)
inline

Definition at line 345 of file XrdSysPthread.hh.

345 {status = pthread_rwlock_rdlock(&lock);}

References lock.

◆ ReInitialize() [1/2]

void XrdSysRWLock::ReInitialize ( )
inline

Definition at line 380 of file XrdSysPthread.hh.

381 {
382  pthread_rwlock_destroy(&lock);
383  pthread_rwlock_init(&lock, NULL);
384 }

References lock.

◆ ReInitialize() [2/2]

void XrdSysRWLock::ReInitialize ( PrefType  )
inline

Definition at line 367 of file XrdSysPthread.hh.

368 {
369  pthread_rwlock_destroy(&lock);
370 #if defined(__linux__) && (defined(__GLIBC__) || defined(__UCLIBC__))
371  pthread_rwlockattr_t attr;
372  pthread_rwlockattr_setkind_np(&attr,
373  PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
374  pthread_rwlock_init(&lock, &attr);
375 #else
376  pthread_rwlock_init(&lock, NULL);
377 #endif
378 }

References lock.

Referenced by XrdCl::Env::ReInitializeLock().

+ Here is the caller graph for this function:

◆ UnLock()

◆ WriteLock() [1/2]

◆ WriteLock() [2/2]

void XrdSysRWLock::WriteLock ( int &  status)
inline

Definition at line 346 of file XrdSysPthread.hh.

346 {status = pthread_rwlock_wrlock(&lock);}

References lock.

Member Data Documentation

◆ lock

pthread_rwlock_t XrdSysRWLock::lock
protected

The documentation for this class was generated from the following file: