|
SimpleKernel 1.17.0
|
自旋锁 More...
#include <spinlock.hpp>

Public Member Functions | |
| __always_inline auto | Lock () -> Expected< void > |
| 获得锁 | |
| __always_inline auto | UnLock () -> Expected< void > |
| 释放锁 | |
构造/析构函数 | |
| SpinLock (const char *_name) | |
| 构造函数 | |
| SpinLock ()=default | |
| SpinLock (const SpinLock &)=delete | |
| SpinLock (SpinLock &&)=default | |
| auto | operator= (const SpinLock &) -> SpinLock &=delete |
| auto | operator= (SpinLock &&) -> SpinLock &=default |
| ~SpinLock ()=default | |
Public Attributes | |
| const char * | name {"unnamed"} |
| 自旋锁名称 | |
Protected Member Functions | |
| __always_inline auto | IsLockedByCurrentCore () -> bool |
| 检查当前 core 是否获得此锁 | |
Protected Attributes | |
| std::atomic_flag | locked_ {ATOMIC_FLAG_INIT} |
| 是否 Lock | |
| std::atomic< size_t > | core_id_ {std::numeric_limits<size_t>::max()} |
| 获得此锁的 core_id | |
| bool | saved_intr_enable_ {false} |
| 保存的中断状态 | |
自旋锁
Definition at line 27 of file spinlock.hpp.
|
inlineexplicit |
构造函数
| _name | 锁名 |
Definition at line 92 of file spinlock.hpp.
|
default |
|
delete |
|
default |
|
default |
|
inlineprotected |
检查当前 core 是否获得此锁
Definition at line 115 of file spinlock.hpp.


|
inline |
获得锁
Definition at line 36 of file spinlock.hpp.

|
inline |
释放锁
Definition at line 66 of file spinlock.hpp.

|
protected |
|
protected |
| const char* SpinLock::name {"unnamed"} |
|
protected |