lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Lock Class Referenceabstract

Abstract lock on a binary Semaphore (the VxWorks variant is not supported). More...

#include <Lock.hh>

Public Member Functions

 Lock (unsigned retries)
 Create the lock free (semaphore full) and keep the retry count retries.
 
void release ()
 Release the lock (give the semaphore).
 
void get ()
 Take the lock, blocking on the semaphore.
 
virtual void cantLock ()=0
 Pure virtual: meant to be called when the lock cannot be obtained after the retries.
 
virtual ~Lock ()
 Does nothing; empty virtual destructor.
 

Detailed Description

Abstract lock on a binary Semaphore (the VxWorks variant is not supported).

Subclasses implement cantLock().

Constructor & Destructor Documentation

◆ Lock()

Pds::Lock::Lock ( unsigned  retries)

Create the lock free (semaphore full) and keep the retry count retries.

◆ ~Lock()

virtual Pds::Lock::~Lock ( )
inlinevirtual

Does nothing; empty virtual destructor.

Member Function Documentation

◆ cantLock()

virtual void Pds::Lock::cantLock ( )
pure virtual

Pure virtual: meant to be called when the lock cannot be obtained after the retries.

◆ get()

void Pds::Lock::get ( )

Take the lock, blocking on the semaphore.

On non-VxWorks builds the retry loop and cantLock() are never reached, because each attempt blocks until it succeeds.

◆ release()

void Pds::Lock::release ( )

Release the lock (give the semaphore).


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