XRootD
Loading...
Searching...
No Matches
XrdSysMutex Class Reference

#include <XrdSysPthread.hh>

+ Inheritance diagram for XrdSysMutex:
+ Collaboration diagram for XrdSysMutex:

Public Member Functions

 XrdSysMutex ()
 
 ~XrdSysMutex ()
 
int CondLock ()
 
void Lock ()
 
int TimedLock (int wait_ms)
 
void UnLock ()
 

Protected Attributes

pthread_mutex_t cs
 

Friends

class XrdSysCondVar2
 

Detailed Description

Definition at line 164 of file XrdSysPthread.hh.

Constructor & Destructor Documentation

◆ XrdSysMutex()

XrdSysMutex::XrdSysMutex ( )
inline

Definition at line 226 of file XrdSysPthread.hh.

226{pthread_mutex_init(&cs, NULL);}
pthread_mutex_t cs

References cs.

◆ ~XrdSysMutex()

XrdSysMutex::~XrdSysMutex ( )
inline

Definition at line 227 of file XrdSysPthread.hh.

227{pthread_mutex_destroy(&cs);}

References cs.

Member Function Documentation

◆ CondLock()

int XrdSysMutex::CondLock ( )
inline

Definition at line 169 of file XrdSysPthread.hh.

170 {if (pthread_mutex_trylock( &cs )) return 0;
171 return 1;
172 }

References cs.

Referenced by XrdSutPFCache::Get().

+ Here is the caller graph for this function:

◆ Lock()

◆ TimedLock()

int XrdSysMutex::TimedLock ( int wait_ms)
inline

Definition at line 211 of file XrdSysPthread.hh.

212 {struct timespec wait;
213 clock_gettime(CLOCK_REALTIME, &wait);
214 wait.tv_sec += (wait_ms / 1000);
215 wait.tv_nsec += (wait_ms % 1000) * 1000000;
216 wait.tv_sec += (wait.tv_nsec / 1000000000);
217 wait.tv_nsec = wait.tv_nsec % 1000000000;
218 return !pthread_mutex_timedlock(&cs, &wait);
219 }

References cs.

◆ UnLock()

Friends And Related Symbol Documentation

◆ XrdSysCondVar2

friend class XrdSysCondVar2
friend

Definition at line 167 of file XrdSysPthread.hh.

References XrdSysCondVar2.

Referenced by XrdSysCondVar2.

Member Data Documentation

◆ cs

pthread_mutex_t XrdSysMutex::cs
protected

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