Is a pthread_rwlock held by a thread automatically released if the thread holding it is killed or abnormally terminated, so the other threads waiting on the lock can acquire it ?
Is a pthread_rwlock held by a thread automatically released if the thread holding it is killed or abnormally terminated, so the other threads waiting on the lock can acquire it ?
Thread moved to Programming Talk for a more appropriate fit.
I wouldn't claim to be an expert in the finer details of pthreads but it seems to me that by default the lock is not released on process termination so waiting threads would continue to block. However, if you set the Robust attribute, this circumstance can be cleaned up by other threads. See http://man7.org/linux/man-pages/man3...robust.3p.html
I think I'll just tryandCode:pthread_setcancelstate(). If this is not enough additionally I'll tryCode:pthread_setcanceltype()andCode:pthread_cleanup_push().Code:pthread_cleanup_pop()
Bookmarks