what is the “attribute” of a pthread mutex?

后端 未结 4 449
暗喜
暗喜 2020-12-14 07:11

The function pthread_mutex_init allows you to specify a pointer to an attribute. But I have yet to find a good explanation of what pthread attributes are. I have always just

4条回答
  •  心在旅途
    2020-12-14 07:34

    If you scroll down the function listing for , you will find a bunch of pthread_mutexattr_... functions, including an init, destroy and functions to set various attributes of a mutex. When you pass NULL, the mutex is created with suitable defaults for all these attributes, but if you need to modify specific attributes, you can construct a pthread_mutexattr_t structure and pass it in.

提交回复
热议问题