mtx_init

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

创建新的拥有 type 类型的互斥体。设置 mutex 所指向的对象为新创建互斥体的标识符。

type 必须拥有下列值之一:

目录

[编辑]参数

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

[编辑]返回值

若成功则为 thrd_success,否则为 thrd_error

[编辑]引用

  • C17 标准(ISO/IEC 9899:2018):
  • 7.26.4.2 The mtx_init function (第 277-278 页)
  • C11 标准(ISO/IEC 9899:2011):
  • 7.26.4.2 The mtx_init function (第 381 页)

[编辑]参阅

mutex 的 C++ 文档
timed_mutex 的 C++ 文档
recursive_mutex 的 C++ 文档
recursive_timed_mutex 的 C++ 文档
close