BitMagic-C++
|
Spin-lock with two-phase acquire (read + cas) padding parameter optionally adds a buffer to avoid CPU cache line contention. More...
#include <bmthreadpool.h>
Public Member Functions | |
spin_lock () noexcept | |
void | lock () noexcept |
Lock the lock. More... | |
bool | try_lock () noexcept |
Try to acquire the lock, return true if successfull. More... | |
void | unlock () noexcept |
Unlock the lock. More... | |
Spin-lock with two-phase acquire (read + cas) padding parameter optionally adds a buffer to avoid CPU cache line contention.
TODO: test if padding realy helps in our case
Generally spin_lock does not have advantage over std::mutex but in some specific cases like WebAssembly it may be better due no "noexcept" property
Definition at line 55 of file bmthreadpool.h.
|
inlinenoexcept |
Lock the lock.
Definition at line 61 of file bmthreadpool.h.
|
inlinenoexcept |
Try to acquire the lock, return true if successfull.
Definition at line 78 of file bmthreadpool.h.
|
inlinenoexcept |
Unlock the lock.
Definition at line 89 of file bmthreadpool.h.