VLink  2.0.0
A high-performance communication middleware
vlink::SpinLockGuard类 参考final

RAII wrapper that locks a SpinLock on construction and unlocks on destruction. 更多...

#include <spin_lock.h>

vlink::SpinLockGuard 的协作图:

Public 成员函数

 SpinLockGuard (SpinLock &lock) noexcept
 Acquires lock immediately. 更多...
 
 ~SpinLockGuard () noexcept
 Releases the held spin lock. 更多...
 

详细描述

RAII wrapper that locks a SpinLock on construction and unlocks on destruction.

Equivalent to std::lock_guard<SpinLock>. Preferred over manual lock / unlock because it is exception-safe.

Example
SpinLock my_lock;
{
SpinLockGuard guard(my_lock);
critical_section();
}

构造及析构函数说明

◆ SpinLockGuard()

vlink::SpinLockGuard::SpinLockGuard ( SpinLock lock)
inlineexplicitnoexcept

Acquires lock immediately.

参数
lockSpin lock to acquire. Must outlive this guard.

◆ ~SpinLockGuard()

vlink::SpinLockGuard::~SpinLockGuard ( )
inlinenoexcept

Releases the held spin lock.

函数调用图:

该类的文档由以下文件生成: