mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-10-25 16:43:17 -06:00
fix potential race condition
This commit is contained in:
1 parent
66e0511141
commit
de5f027bde
1 file changed
+4
-4
@@ -1733,6 +1733,10 @@ __forceinline bool AllClear(unsigned __int32 lock)
|
||||
|
||||
void PgfDB::lock(DB_scope_mode m)
|
||||
{
|
||||
// If another process has resized the file we must resize the map
|
||||
if (mmap_size != ms->file_size)
|
||||
resize_map(ms->file_size, m == WRITER_SCOPE);
|
||||
|
||||
if (m == READER_SCOPE) {
|
||||
#ifndef _WIN32
|
||||
int res = pthread_rwlock_rdlock(&ms->rwlock);
|
||||
@@ -1767,10 +1771,6 @@ void PgfDB::lock(DB_scope_mode m)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// If another process has resized the file we must resize the map
|
||||
if (mmap_size != ms->file_size)
|
||||
resize_map(ms->file_size, m == WRITER_SCOPE);
|
||||
}
|
||||
|
||||
void PgfDB::unlock()
|
||||
|
||||
Reference in new issue
Block a user