tail head cat sleep
QR code linking to this page

manページ  — PTHREAD_MUTEX_INIT

名称

pthread_mutex_init – mutex の作成

内容

ライブラリ

Reentrant C\~Library (libc_r, -lc_r)

書式

#include <pthread.h>

int
pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);

解説

pthread_mutex_init() 関数は、 attr に指定された属性で新しい mutex を作成します。 attr が NULL の場合には、デフォルトの属性が使用されます。

戻り値

問題がない場合は、 pthread_mutex_init() は 0 を返し、 mutex に新しい mutex の ID を入れます。 問題がある場合は、そのエラーを示すためにエラー番号が返されます。

エラー

pthread_mutex_init() は以下の場合に失敗します。
[EINVAL]
  attr によって指定された値が無効です。
[ENOMEM]
  プロセスが別の mutex の作成のための十分なメモリを割り当てられません。
[EAGAIN]
  別の mutex を作成するために一時的なリソースが不足しています。

関連項目

pthread_mutex_destroy(3), pthread_mutex_lock(3), pthread_mutex_trylock(3), pthread_mutex_unlock(3)

規格

pthread_mutex_init()IEEE Std 1003.1-96 ("POSIX.1") に適合しています。

PTHREAD_MUTEX_INIT (3) July 29, 1998

tail head cat sleep
QR code linking to this page


このマニュアルページサービスについてのご意見は Ben Bullock にお知らせください。 Privacy policy.

On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
— Charles Babbage