mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 01:22:51 -06:00
fix the compilation on Windows and macOS
This commit is contained in:
@@ -388,7 +388,8 @@ PgfDB::~PgfDB()
|
|||||||
#ifndef MREMAP_MAYMOVE
|
#ifndef MREMAP_MAYMOVE
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
pthread_rwlock_destroy(&ms->rwlock);
|
pthread_rwlock_destroy(&ms->rwlock);
|
||||||
pthread_mutex_destroy(&ms->mutex);
|
pthread_mutex_destroy(&ms->write_mutex);
|
||||||
|
pthread_mutex_destroy(&ms->rel_mutex);
|
||||||
::free(ms);
|
::free(ms);
|
||||||
::free(base);
|
::free(base);
|
||||||
} else
|
} else
|
||||||
@@ -1674,6 +1675,7 @@ void PgfDB::resize_map(size_t new_size)
|
|||||||
if ((res = pthread_rwlock_unlock(&ms->rwlock)) != 0)
|
if ((res = pthread_rwlock_unlock(&ms->rwlock)) != 0)
|
||||||
throw pgf_systemerror(res);
|
throw pgf_systemerror(res);
|
||||||
#else
|
#else
|
||||||
|
while(true) {
|
||||||
while(true) {
|
while(true) {
|
||||||
temp = ms->rwlock;
|
temp = ms->rwlock;
|
||||||
assert(Writer(temp));
|
assert(Writer(temp));
|
||||||
@@ -1688,6 +1690,7 @@ void PgfDB::resize_map(size_t new_size)
|
|||||||
//Decrement writer count
|
//Decrement writer count
|
||||||
if (InterlockedCompareExchange(&ms->rwlock, SetWriter(temp, false), temp) == temp)
|
if (InterlockedCompareExchange(&ms->rwlock, SetWriter(temp, false), temp) == temp)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user