|
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. | |
| bool | try_lock () noexcept |
| Try to acquire the lock, return true if successfull. | |
| void | unlock () noexcept |
| Unlock the lock. | |
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 |
Definition at line 58 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.