mtx_init
來自 cppreference.com
在標頭檔案 <threads.h> 中定義 |
||
int mtx_init( mtx_t* mutex, int type ); |
(C11 起) | |
使用 type
建立一個新的互斥物件。mutex
所指向的物件被設定為新建立互斥的識別符號。
type
必須是以下值之一:
- mtx_plain - 建立一個簡單的非遞迴互斥體。
- mtx_timed - 建立一個支援超時的非遞迴互斥體。
- mtx_plain | mtx_recursive - 建立一個遞迴互斥體。
- mtx_timed | mtx_recursive - 建立一個支援超時的遞迴互斥體。
目錄 |
[編輯] 引數
mutex | - | 指向要初始化的互斥體的指標 |
型別 | - | 互斥體的型別 |
[編輯] 返回值
如果成功則為 thrd_success,否則為 thrd_error。
[編輯] 參考資料
- C17 標準 (ISO/IEC 9899:2018)
- 7.26.4.2 mtx_init 函式 (p: 277-278)
- C11 標準 (ISO/IEC 9899:2011)
- 7.26.4.2 mtx_init 函式 (p: 381)
[編輯] 另請參閱
C++ 文件,關於 mutex
| |
C++ 文件,關於 timed_mutex
| |
C++ 文件,關於 recursive_mutex
| |
C++ 文件,關於 recursive_timed_mutex
|