7#include "libxr_def.hpp"
8#include "libxr_system.hpp"
18 const int ans = pthread_mutex_lock(&mutex_handle_);
28 const int ans = pthread_mutex_trylock(&mutex_handle_);
Mutex()
构造函数,初始化互斥锁 Constructor to initialize the mutex.
ErrorCode Lock()
加锁,如果锁已被占用,则阻塞等待 Lock the mutex, blocking if it is already locked.
ErrorCode TryLock()
尝试加锁,如果锁已被占用,则立即返回失败 Attempt to lock the mutex, returning immediately if already locked.
~Mutex()
析构函数,销毁互斥锁 Destructor to destroy the mutex.
void Unlock()
解锁互斥锁 Unlock the mutex.
LibXR 命名空间 / LibXR namespace.
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes
@ FAILED
操作失败 / Operation failed
@ OK
操作成功 / Operation successful