forked from GitHub/gf-core
thread local for MSVC
This commit is contained in:
@@ -45,10 +45,15 @@ int last_error_to_errno()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
PGF_INTERNAL __declspec( thread ) unsigned char* current_base = NULL;
|
||||
PGF_INTERNAL __declspec( thread ) PgfDB* current_db = NULL;
|
||||
PGF_INTERNAL __declspec( thread ) DB_scope *last_db_scope = NULL;
|
||||
#else
|
||||
PGF_INTERNAL __thread unsigned char* current_base __attribute__((tls_model("initial-exec"))) = NULL;
|
||||
PGF_INTERNAL __thread PgfDB* current_db __attribute__((tls_model("initial-exec"))) = NULL;
|
||||
PGF_INTERNAL __thread DB_scope *last_db_scope __attribute__((tls_model("initial-exec"))) = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
#define ptr(T,o) ((T*) (base + (o)))
|
||||
|
||||
|
||||
@@ -5,8 +5,13 @@
|
||||
|
||||
class PgfDB;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
extern PGF_INTERNAL_DECL __declspec( thread ) unsigned char* current_base;
|
||||
extern PGF_INTERNAL_DECL __declspec( thread ) PgfDB* current_db;
|
||||
#else
|
||||
extern PGF_INTERNAL_DECL __thread unsigned char* current_base __attribute__((tls_model("initial-exec")));
|
||||
extern PGF_INTERNAL_DECL __thread PgfDB* current_db __attribute__((tls_model("initial-exec")));
|
||||
#endif
|
||||
|
||||
struct block_descr;
|
||||
struct malloc_state;
|
||||
|
||||
Reference in New Issue
Block a user