fpmas 1.6
Public Member Functions | List of all members
fpmas::synchro::ghost::SingleThreadMutex< T > Class Template Reference

#include <single_thread_mutex.h>

Inheritance diagram for fpmas::synchro::ghost::SingleThreadMutex< T >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::synchro::ghost::SingleThreadMutex< T >:
Collaboration graph
[legend]

Public Member Functions

 SingleThreadMutex (T &data)
 
T & data () override
 
const T & data () const override
 
void lock () override
 
void unlock () override
 
bool locked () const override
 
void lockShared () override
 
void unlockShared () override
 
int sharedLockCount () const override
 
- Public Member Functions inherited from fpmas::api::synchro::Mutex< T >
virtual T & data ()=0
 
virtual const T & data () const =0
 
virtual const T & read ()=0
 
virtual void releaseRead ()=0
 
virtual T & acquire ()=0
 
virtual void releaseAcquire ()=0
 
virtual void lock ()=0
 
virtual void unlock ()=0
 
virtual bool locked () const =0
 
virtual void lockShared ()=0
 
virtual void unlockShared ()=0
 
virtual int sharedLockCount () const =0
 
virtual void synchronize ()=0
 

Additional Inherited Members

virtual void _lock ()=0
 
virtual void _lockShared ()=0
 
virtual void _unlock ()=0
 
virtual void _unlockShared ()=0
 

Detailed Description

template<typename T>
class fpmas::synchro::ghost::SingleThreadMutex< T >

A base Mutex implementation designed to work in a single threaded environment. In consequence, no concurrency management is required.

Constructor & Destructor Documentation

◆ SingleThreadMutex()

template<typename T >
fpmas::synchro::ghost::SingleThreadMutex< T >::SingleThreadMutex ( T &  data)
inline

SingleThreadMutex constructor.

Parameters
datareference to node data

Member Function Documentation

◆ data() [1/2]

template<typename T >
T & fpmas::synchro::ghost::SingleThreadMutex< T >::data ( )
inlineoverridevirtual

Direct access to internal data representation.

Does not guarantee any concurrent access or data update management.

Returns
direct reference to internal data

Implements fpmas::api::synchro::Mutex< T >.

◆ data() [2/2]

template<typename T >
const T & fpmas::synchro::ghost::SingleThreadMutex< T >::data ( ) const
inlineoverridevirtual

Direct access to internal data representation.

Does not guarantee any concurrent access or data update management.

Returns
direct reference to internal data

Implements fpmas::api::synchro::Mutex< T >.

◆ lock()

template<typename T >
void fpmas::synchro::ghost::SingleThreadMutex< T >::lock ( )
inlineoverridevirtual

Locks the mutex.

This function blocks until internal data is effectively locked. Upon return, an exclusive access to the internal data is guaranteed. However, contrary to the acquire() function, this operation does not involve any data update or write operation handling.

A locked mutex must be unlocked using unlock().

Implements fpmas::api::synchro::Mutex< T >.

◆ unlock()

template<typename T >
void fpmas::synchro::ghost::SingleThreadMutex< T >::unlock ( )
inlineoverridevirtual

Unlocks a mutex previously locked with lock().

Implements fpmas::api::synchro::Mutex< T >.

◆ locked()

template<typename T >
bool fpmas::synchro::ghost::SingleThreadMutex< T >::locked ( ) const
inlineoverridevirtual

Returns true if and only if the mutex has been locked and not yet unlocked.

Returns
true iff mutex is locked

Implements fpmas::api::synchro::Mutex< T >.

◆ lockShared()

template<typename T >
void fpmas::synchro::ghost::SingleThreadMutex< T >::lockShared ( )
inlineoverridevirtual

Obtains a shared lock access to the mutex.

This function blocks until a shared lock access to mutex is effectively obtained. Contrary to lock(), multiple threads are allowed to simultaneously obtain a shared lock to the mutex.

The mutex must then be unlocked using unlockShared().

Implements fpmas::api::synchro::Mutex< T >.

◆ unlockShared()

template<typename T >
void fpmas::synchro::ghost::SingleThreadMutex< T >::unlockShared ( )
inlineoverridevirtual

Unlocks a mutex previously locked with lockShared().

Semantically, all threads that called lockShared() must call unlockShared() to finally unlock the mutex.

Implements fpmas::api::synchro::Mutex< T >.

◆ sharedLockCount()

template<typename T >
int fpmas::synchro::ghost::SingleThreadMutex< T >::sharedLockCount ( ) const
inlineoverridevirtual

Returns the count of threads that currently own a shared lock access to the mutex.

Returns
shared lock count

Implements fpmas::api::synchro::Mutex< T >.


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