命名空间
变体
操作

mtx_init

来自 cppreference.cn
< c‎ | thread
定义于头文件 <threads.h>
int mtx_init( mtx_t* mutex, int type );
(since C11)

使用 type 创建一个新的互斥对象。由 mutex 指向的对象被设置为新创建的互斥量的标识符。

type 必须具有以下值之一

目录

[edit] 参数

mutex - 指向要初始化的互斥锁的指针
type - 互斥锁的类型

[edit] 返回值

thrd_success 如果成功,则返回 thrd_error ,否则返回错误。

[edit] 参考文献

  • 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)

[edit] 参见

C++ 文档 关于 mutex
C++ 文档 关于 timed_mutex
C++ 文档 关于 recursive_mutex
C++ 文档 关于 recursive_timed_mutex