Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::Semaphore::Lock Class Reference

Locking class. More...

#include <Semaphore.h>

Public Member Functions

 Lock ()
 Default constructor which sees to it that it is released.
 
 Lock (const Semaphore &semaphore, const TimeSpec &timeout)
 Constructor see acquire() function.
 
 Lock (const Semaphore &semaphore, bool tryWait=false)
 Constructor.
 
 ~Lock ()
 Destructor cleaning up.
 
bool acquire (const Semaphore &semaphore, const TimeSpec &timeout)
 Waits to acquire the semaphore. Is called from the constructor. The timeout is the time the function will block. Use method isAcquired to check what the current status is.
 
bool acquire (const Semaphore &semaphore, bool tryWait=false)
 Waits to acquire the semaphore. Is also called from the constructor. When the 'tryWait' argument is true the method will not block but return immediately.
 
bool isAcquired () const
 See if semaphore was acquired or timed-out.
 
void release (bool relinquish=true)
 Releases.
 

Detailed Description

Locking class.

Constructor & Destructor Documentation

◆ Lock() [1/3]

sf::Semaphore::Lock::Lock ( )
inline

Default constructor which sees to it that it is released.

◆ Lock() [2/3]

sf::Semaphore::Lock::Lock ( const Semaphore semaphore,
const TimeSpec timeout 
)
inlineexplicit

Constructor see acquire() function.

Parameters
semaphoreSemaphore to lock.
timeoutTimeout to wait for a lock.

◆ Lock() [3/3]

sf::Semaphore::Lock::Lock ( const Semaphore semaphore,
bool  tryWait = false 
)
inlineexplicit

Constructor.

See also
acquire()
Parameters
semaphoreSemaphore to lock.
tryWaitWhen True the constructor is blocking.

◆ ~Lock()

sf::Semaphore::Lock::~Lock ( )
inline

Destructor cleaning up.

Member Function Documentation

◆ acquire() [1/2]

bool sf::Semaphore::Lock::acquire ( const Semaphore semaphore,
bool  tryWait = false 
)

Waits to acquire the semaphore. Is also called from the constructor. When the 'tryWait' argument is true the method will not block but return immediately.

Parameters
semaphoreSemaphore to lock.
tryWaitWhen True the function is blocking.
Returns
True when acquired.

◆ acquire() [2/2]

bool sf::Semaphore::Lock::acquire ( const Semaphore semaphore,
const TimeSpec timeout 
)

Waits to acquire the semaphore. Is called from the constructor. The timeout is the time the function will block. Use method isAcquired to check what the current status is.

Parameters
semaphoreSemaphore to lock.
timeoutTimeout to wait for a lock.
Returns
True when acquired.

◆ isAcquired()

bool sf::Semaphore::Lock::isAcquired ( ) const
inline

See if semaphore was acquired or timed-out.

Returns
True when acquired.

◆ release()

void sf::Semaphore::Lock::release ( bool  relinquish = true)

Releases.

Parameters
relinquishTrue when this lock can acquire again.

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