![]() |
MySQL 26.7.0
Source Code Documentation
|
Implementation of a spin-lock mutex. More...
#include <spin_lock_mutex.h>
Public Member Functions | |
| Spin_lock_mutex (const Spin_lock_mutex &)=delete | |
| Spin_lock_mutex (Spin_lock_mutex &&)=delete | |
| Spin_lock_mutex & | operator= (const Spin_lock_mutex &src)=delete |
| Spin_lock_mutex & | operator= (Spin_lock_mutex &&src)=delete |
| Spin_lock_mutex (Mutex_key key={}) | |
| ~Spin_lock_mutex ()=default | |
| void | lock () noexcept |
| Acquire a lock, blocks access to a critical section until "unlock" is called. More... | |
| bool | try_lock () noexcept |
| Non-blocking try-lock operation. More... | |
| void | unlock () |
| Unblocks access to a critical section for other threads. More... | |
Static Private Member Functions | |
| static void | spin_yield () noexcept |
Private Attributes | |
| std::atomic_flag | m_lock = ATOMIC_FLAG_INIT |
| Internal synchronization boolean, true means that lock is currently owned Since C++20, default constructor sets atomic_flag to "clear" state We use atomic_flag because it is guaranteed to be lock free. More... | |
Implementation of a spin-lock mutex.
Satisfies requirements of Mutex
|
delete |
|
delete |
|
inline |
|
default |
|
noexcept |
Acquire a lock, blocks access to a critical section until "unlock" is called.
|
delete |
|
delete |
|
inlinestaticprivatenoexcept |
|
noexcept |
Non-blocking try-lock operation.
| true | Lock has been acquired |
| false | Lock has NOT been acquired |
| void mysql::concurrency::Spin_lock_mutex::unlock | ( | ) |
Unblocks access to a critical section for other threads.
|
private |
Internal synchronization boolean, true means that lock is currently owned Since C++20, default constructor sets atomic_flag to "clear" state We use atomic_flag because it is guaranteed to be lock free.