?
Ce document utilise Manuel du site Web PHP chinois Libérer
在頭文件<threads.h>中定義 | ||
---|---|---|
int mtx_init(mtx_t * mutex,int type); | (自C11以來) |
使用type
創(chuàng)建一個新的互斥對象,指向的對象mutex
被設(shè)置為新創(chuàng)建的互斥體的標(biāo)識符。
type
必須具有以下值之一:
mtx_plain
- 創(chuàng)建一個簡單的非遞歸互斥體。
mtx_timed
- 創(chuàng)建支持超時的非遞歸互斥鎖。
mtx_plain
|
mtx_recursive
- 創(chuàng)建遞歸互斥。
mtx_timed
|
mtx_recursive
- 創(chuàng)建一個支持超時的遞歸互斥體。
mutex | - | 指向要初始化的互斥體的指針 |
---|---|---|
type | - | 互斥體的類型 |
如果成功則返回 thrd_success,否則返回 thrd_error。
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.26.4.2 mtx_init 函數(shù)(p:381)
| recursive_timed_mutex 的 C ++文檔 |