mn::atomic_spinlock< T > Class Template Reference
This class implements a simple spinlack, whit atomic operations. More...
#include <mn_atomic_spinlock.hpp>
Inheritance diagram for mn::atomic_spinlock< T >:
Collaboration diagram for mn::atomic_spinlock< T >:
Public Types | |
using | self_type = atomic_spinlock< T > |
using | value_type = T |
using | pointer = value_type * |
using | reference = value_type & |
using | lock_guard = basic_autolock< self_type > |
Public Types inherited from mn::ILockObject | |
using | this_type = ILockObject |
Public Member Functions | |
atomic_spinlock () | |
Construct a new atomic_spinlock. More... | |
atomic_spinlock (const reference value) | |
Construct a new atomic_spinlock and initializes it with the given value. More... | |
virtual int | lock (unsigned int not_use=0) |
virtual int | time_lock (const struct timespec *timeout) |
virtual int | unlock () |
virtual bool | try_lock () |
virtual bool | is_initialized () const |
operator value_type () | |
Converts the atomic_spinlock to value_type. More... | |
self_type & | operator= (const value_type &oValue) |
bool | operator== (const value_type &oValue) |
bool | operator!= (const value_type &oValue) |
atomic_spinlock (const self_type &)=delete | |
self_type & | operator= (const self_type &)=delete |
Public Member Functions inherited from mn::ILockObject | |
ILockObject () | |
virtual bool | is_locked () const =0 |
Is locked? More... | |
Protected Attributes | |
atomic_bool | m_locked |
value_type | m_value |
Detailed Description
template<typename T>
class mn::atomic_spinlock< T >
This class implements a simple spinlack, whit atomic operations.
- Template Parameters
-
T The type of the object to lock
Member Typedef Documentation
◆ lock_guard
template<typename T >
using mn::atomic_spinlock< T >::lock_guard = basic_autolock<self_type> |
◆ pointer
template<typename T >
using mn::atomic_spinlock< T >::pointer = value_type* |
◆ reference
template<typename T >
using mn::atomic_spinlock< T >::reference = value_type& |
◆ self_type
template<typename T >
using mn::atomic_spinlock< T >::self_type = atomic_spinlock<T> |
◆ value_type
template<typename T >
using mn::atomic_spinlock< T >::value_type = T |
Constructor & Destructor Documentation
◆ atomic_spinlock() [1/3]
template<typename T >
|
inline |
Construct a new atomic_spinlock.
◆ atomic_spinlock() [2/3]
template<typename T >
|
inlineexplicit |
Construct a new atomic_spinlock and initializes it with the given value.
- Parameters
-
value The locked value
◆ atomic_spinlock() [3/3]
template<typename T >
|
delete |
Member Function Documentation
◆ is_initialized()
template<typename T >
|
inlinevirtual |
Is the atomic_spinlock created (initialized) ?
- Returns
- true if the atomic_spinlock created (initialized)
Implements mn::ILockObject.
◆ lock()
template<typename T >
|
inlinevirtual |
◆ operator value_type()
template<typename T >
|
inline |
Converts the atomic_spinlock to value_type.
- Returns
- The convertet value
◆ operator!=()
template<typename T >
|
inline |
◆ operator=() [1/2]
template<typename T >
|
delete |
◆ operator=() [2/2]
template<typename T >
|
inline |
◆ operator==()
template<typename T >
|
inline |
◆ time_lock()
template<typename T >
|
inlinevirtual |
Implements mn::ILockObject.
◆ try_lock()
template<typename T >
|
inlinevirtual |
Try to lock the atomic_spinlock
- Note
- call lock with timeout from 0
- Returns
- true if the Lock was acquired, false when not
Reimplemented from mn::ILockObject.
◆ unlock()
template<typename T >
|
inlinevirtual |
unlock (give) a atomic_spinlock.
Implements mn::ILockObject.
Member Data Documentation
◆ m_locked
template<typename T >
|
protected |
◆ m_value
template<typename T >
|
protected |
The documentation for this class was generated from the following file: