finished porting to Windows

This commit is contained in:
krangelov
2021-11-13 05:40:38 +01:00
parent 397d22b49b
commit 92ecc8cc1d
4 changed files with 266 additions and 90 deletions

View File

@@ -54,7 +54,11 @@ public:
}
};
#ifndef _WIN32
#include "ipc.h"
#endif
enum DB_scope_mode {READER_SCOPE, WRITER_SCOPE};
class PgfDB {
private:
@@ -62,10 +66,11 @@ private:
const char *filepath;
malloc_state* ms;
ipc_rwlock_t *rwlock;
#ifdef _WIN32
#ifndef _WIN32
pthread_rwlock_t *rwlock;
#else
HANDLE hMap;
HANDLE hRWEvent;
#endif
friend class PgfReader;
@@ -109,11 +114,12 @@ private:
PGF_INTERNAL_DECL object malloc_internal(size_t bytes);
PGF_INTERNAL_DECL void free_internal(object o);
void lock(DB_scope_mode m);
void unlock();
friend class DB_scope;
};
enum DB_scope_mode {READER_SCOPE, WRITER_SCOPE};
class PGF_INTERNAL_DECL DB_scope {
public:
DB_scope(PgfDB *db, DB_scope_mode m);