pthread_mutexattr_setrobust 可以应用于 pthread_rwlock_t 吗?

can pthread_mutexattr_setrobust apply to pthread_rwlock_t?

mutex 的 robustness 对我的程序非常重要,因为它可以处理进程在不释放 mutex 的情况下死亡的情况。

但是根据文档,pthread_mutexattr_setrobust只适用于pthread_mutex_t,而不适用于pthread_rwlock_t,有什么方法可以设置pthread_rwlock_t的健壮性吗?或者它的实现默认是健壮的?

according to the document, pthread_mutexattr_setrobust only apply to pthread_mutex_t

更准确地说,pthread_mutexattr_setrobust() 设置 pthread_mutexattr_t 对象的 属性,这些(仅)用于配置类型 pthread_mutex_t 的对象。这发生在通过 pthread_mutex_init().

初始化互斥量时

read/write个锁对应的初始化函数是pthread_rwlock_init(), and its documentation shows that the corresponding attribute object type, accepted by that function, is pthread_rwlockattr_t. Implementations may provide whatever properties they like as extensions, but the only one specified for this type by the current version of POSIX is pshared。因此,不,pthreads read/write 锁没有(便携式)健壮性选项。