the r/w lock is now in the database itself

This commit is contained in:
krangelov
2021-11-15 13:13:00 +01:00
parent 0a204a47f7
commit c1690ffa77
5 changed files with 141 additions and 417 deletions

View File

@@ -54,10 +54,6 @@ public:
}
};
#ifndef _WIN32
#include "ipc.h"
#endif
enum DB_scope_mode {READER_SCOPE, WRITER_SCOPE};
class PgfDB {
@@ -66,9 +62,7 @@ private:
const char *filepath;
malloc_state* ms;
#ifndef _WIN32
pthread_rwlock_t *rwlock;
#else
#ifdef _WIN32
HANDLE hMap;
HANDLE hRWEvent;
#endif
@@ -114,6 +108,10 @@ private:
PGF_INTERNAL_DECL object malloc_internal(size_t bytes);
PGF_INTERNAL_DECL void free_internal(object o);
PGF_INTERNAL_DECL void register_process(bool *is_first);
PGF_INTERNAL_DECL void unregister_process();
void lock(DB_scope_mode m);
void unlock();