diff --git a/docs/en_us/6_Other.md b/docs/en_us/6_Other.md index f3edab5..087832e 100644 --- a/docs/en_us/6_Other.md +++ b/docs/en_us/6_Other.md @@ -23,7 +23,7 @@ Asynchronous mutex is a mutex suitable for asynchronous environments. In contras Create mutex ```cpp -AsyncMutex _mtx {}; // Pass the true argument to lock during initialization +fv::AsyncMutex _mtx {}; // Pass the true argument to lock during initialization ``` Lock: @@ -48,7 +48,7 @@ _mtx.Unlock (); To know if it is locked: ```cpp -_mtx.IsLocked (); +bool _locked = _mtx.IsLocked (); ``` ## Asynchronous semaphore @@ -60,7 +60,7 @@ An asynchronous semaphore is a semaphore suitable for asynchrony. In contrast t Create semaphore: ```cpp -AsyncSemaphore _sema { 1 }; // Parameter means the initial number of resources +fv::AsyncSemaphore _sema { 1 }; // Parameter means the initial number of resources ``` Acquire resources: @@ -85,5 +85,5 @@ _mtx.Release (); Get the count of available resources: ```cpp -_mtx.GetResCount (); +size_t _count = _mtx.GetResCount (); ``` diff --git a/docs/zh_hans/6_Other.md b/docs/zh_hans/6_Other.md index bb420d9..bad1f43 100644 --- a/docs/zh_hans/6_Other.md +++ b/docs/zh_hans/6_Other.md @@ -23,7 +23,7 @@ boost::asio::io_context &_ctx = fv::Tasks::GetContext (); 创建锁: ```cpp -AsyncMutex _mtx {}; // 参数传 true 代表初始化时加锁 +fv::AsyncMutex _mtx {}; // 参数传 true 代表初始化时加锁 ``` 加锁: @@ -48,7 +48,7 @@ _mtx.Unlock (); 获知是否已锁: ```cpp -_mtx.IsLocked (); +bool _locked = _mtx.IsLocked (); ``` ## 异步信号量 @@ -60,7 +60,7 @@ _mtx.IsLocked (); 创建信号量: ```cpp -AsyncSemaphore _sema { 1 }; // 参数代表初始资源数 +fv::AsyncSemaphore _sema { 1 }; // 参数代表初始资源数 ``` 获取资源: @@ -85,5 +85,5 @@ _mtx.Release (); 获知现有资源数: ```cpp -_mtx.GetResCount (); +size_t _count = _mtx.GetResCount (); ```