VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
vlink::SpinLockGuard类 参考final

RAII guard that acquires a SpinLock on construction and releases it on destruction. 更多...

#include <spin_lock.h>

vlink::SpinLockGuard 的协作图:

Public 成员函数

 SpinLockGuard (SpinLock &lock) noexcept
 Acquires lock immediately.
 ~SpinLockGuard () noexcept
 Releases the lock held by this guard.

详细描述

RAII guard that acquires a SpinLock on construction and releases it on destruction.

Analogous 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.

参数
lockThe SpinLock to acquire. Must outlive this guard.
函数调用图:

◆ ~SpinLockGuard()

vlink::SpinLockGuard::~SpinLockGuard ( )
inlinenoexcept

Releases the lock held by this guard.


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