CodePudding user response:
Pthread_rwlock Shared memory is used to implement process between the lock? , I only know that in the Shared memory used pthread_mutex_t + condition variables can realize mutual exclusion, also need to set pthread_mutexattr_setrobust_np, also have to deal with the process after locking the influence of abnormal exit are (not),Like you have the owner didn't see pthread_rwlock exception handling mechanism of quitting,
Suggested use: cache file + flock to achieve interprocess read-write lock
Or use sys_v semphore implementation