名前空間
変種

mtx_init

提供: cppreference.com
< c | thread
<tbody> </tbody>
ヘッダ <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 - 初期化するミューテックスを指すポインタ
type - ミューテックスの種類

戻り値

成功した場合は thrd_success、そうでなければ thrd_error

参考文献

  • C11 standard (ISO/IEC 9899:2011):
  • 7.26.4.2 The mtx_init function (p: 381)

関連項目

timed_mutexC++リファレンス
recursive_mutexC++リファレンス
recursive_timed_mutexC++リファレンス