mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-08 10:42:50 -06:00
make r/w lock shared only if there is a shared file as well
This commit is contained in:
@@ -690,10 +690,12 @@ 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 (fd > 0) {
|
||||||
if ((code = pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) != 0) {
|
if ((code = pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) != 0) {
|
||||||
pthread_rwlockattr_destroy(&attr);
|
pthread_rwlockattr_destroy(&attr);
|
||||||
throw pgf_systemerror(code);
|
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);
|
||||||
throw pgf_systemerror(code);
|
throw pgf_systemerror(code);
|
||||||
|
|||||||
Reference in New Issue
Block a user