命名空间
变体
操作

mtx_init

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

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

type 必须是以下值之一:

目录

[编辑] 参数

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