forked from GitHub/gf-core
make r/w lock shared only if there is a shared file as well
This commit is contained in:
@@ -690,9 +690,11 @@ void PgfDB::init_state(size_t size)
|
|||||||
if ((code = pthread_rwlockattr_init(&attr)) != 0) {
|
if ((code = pthread_rwlockattr_init(&attr)) != 0) {
|
||||||
throw pgf_systemerror(code);
|
throw pgf_systemerror(code);
|
||||||
}
|
}
|
||||||
if ((code = pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) != 0) {
|
if (fd > 0) {
|
||||||
pthread_rwlockattr_destroy(&attr);
|
if ((code = pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) != 0) {
|
||||||
throw pgf_systemerror(code);
|
pthread_rwlockattr_destroy(&attr);
|
||||||
|
throw pgf_systemerror(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((code = pthread_rwlock_init(&ms->rwlock, &attr)) != 0) {
|
if ((code = pthread_rwlock_init(&ms->rwlock, &attr)) != 0) {
|
||||||
pthread_rwlockattr_destroy(&attr);
|
pthread_rwlockattr_destroy(&attr);
|
||||||
|
|||||||
Reference in New Issue
Block a user