2
mutex属性を1つだけ作成して使用して、複数の再帰的mutexを初期化できますか?または、作成したいミューテックスごとに1つのミューテックス属性を作成する必要がありますか? 基本的に私は次のコードは正しいですか?C - mutex属性
int err;
int bufferLength = 10;
pthread_mutexattr_t recursiveAttr;
pthread_mutex_t mutexes[bufferLength];
for(int index = 0; index < bufferLength; index++){
err = pthread_mutex_init(&mutexes[i], &recursiveAttr);
if(err != 0){
perror("Error initializing the mutex");
}
}