mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
fix error reporting when the r/w lock is created
This commit is contained in:
@@ -685,17 +685,18 @@ void PgfDB::init_state(size_t size)
|
|||||||
ms->transient_concr_revisions = 0;
|
ms->transient_concr_revisions = 0;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
int code;
|
||||||
pthread_rwlockattr_t attr;
|
pthread_rwlockattr_t attr;
|
||||||
if (pthread_rwlockattr_init(&attr) != 0) {
|
if ((code = pthread_rwlockattr_init(&attr)) != 0) {
|
||||||
throw pgf_systemerror(errno);
|
throw pgf_systemerror(code);
|
||||||
}
|
}
|
||||||
if (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(errno);
|
throw pgf_systemerror(code);
|
||||||
}
|
}
|
||||||
if (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(errno);
|
throw pgf_systemerror(code);
|
||||||
}
|
}
|
||||||
pthread_rwlockattr_destroy(&attr);
|
pthread_rwlockattr_destroy(&attr);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user