summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Etcheverry <neikeq@users.noreply.github.com>2018-07-29 22:36:44 +0200
committerGitHub <noreply@github.com>2018-07-29 22:36:44 +0200
commitb3919dcb44988c72a46e3b97beb41fba68219d4c (patch)
tree9871ca45c57d21bb25d1df59586182528b7a9efa
parent317dee95de84f3dca47b5ecc386975d6e37a9702 (diff)
parent0deb8dda517aee11280bcaf12d96456d5a404ad3 (diff)
Merge pull request #20582 from hpvb/fix-mono-mingw
Fix Mono compilation on Windows/Ming
-rw-r--r--modules/mono/utils/thread_local.cpp12
-rw-r--r--modules/mono/utils/thread_local.h17
2 files changed, 19 insertions, 10 deletions
diff --git a/modules/mono/utils/thread_local.cpp b/modules/mono/utils/thread_local.cpp
index 6f8b0f90bc..248f24c855 100644
--- a/modules/mono/utils/thread_local.cpp
+++ b/modules/mono/utils/thread_local.cpp
@@ -63,7 +63,13 @@ struct ThreadLocalStorage::Impl {
#endif
}
- Impl(void (*p_destr_callback_func)(void *)) {
+#ifdef WINDOWS_ENABLED
+#define _CALLBACK_FUNC_ __stdcall
+#else
+#define _CALLBACK_FUNC_
+#endif
+
+ Impl(void _CALLBACK_FUNC_ (*p_destr_callback_func)(void *)) {
#ifdef WINDOWS_ENABLED
dwFlsIndex = FlsAlloc(p_destr_callback_func);
ERR_FAIL_COND(dwFlsIndex == FLS_OUT_OF_INDEXES);
@@ -89,10 +95,12 @@ void ThreadLocalStorage::set_value(void *p_value) const {
pimpl->set_value(p_value);
}
-void ThreadLocalStorage::alloc(void (*p_destr_callback)(void *)) {
+void ThreadLocalStorage::alloc(void _CALLBACK_FUNC_ (*p_destr_callback)(void *)) {
pimpl = memnew(ThreadLocalStorage::Impl(p_destr_callback));
}
+#undef _CALLBACK_FUNC_
+
void ThreadLocalStorage::free() {
memdelete(pimpl);
pimpl = NULL;
diff --git a/modules/mono/utils/thread_local.h b/modules/mono/utils/thread_local.h
index 7ff10b4efc..d0c5df3c91 100644
--- a/modules/mono/utils/thread_local.h
+++ b/modules/mono/utils/thread_local.h
@@ -65,12 +65,18 @@
#include "core/typedefs.h"
+#ifdef WINDOWS_ENABLED
+#define _CALLBACK_FUNC_ __stdcall
+#else
+#define _CALLBACK_FUNC_
+#endif
+
struct ThreadLocalStorage {
void *get_value() const;
void set_value(void *p_value) const;
- void alloc(void (*p_dest_callback)(void *));
+ void alloc(void _CALLBACK_FUNC_ (*p_dest_callback)(void *));
void free();
private:
@@ -85,17 +91,10 @@ class ThreadLocal {
T init_val;
-#ifdef WINDOWS_ENABLED
-#define _CALLBACK_FUNC_ __stdcall
-#else
-#define _CALLBACK_FUNC_
-#endif
-
static void _CALLBACK_FUNC_ destr_callback(void *tls_data) {
memdelete(static_cast<T *>(tls_data));
}
-#undef _CALLBACK_FUNC_
T *_tls_get_value() const {
void *tls_data = storage.get_value();
@@ -156,6 +155,8 @@ private:
bool &flag;
};
+#undef _CALLBACK_FUNC_
+
#define _TLS_RECURSION_GUARD_V_(m_ret) \
static _THREAD_LOCAL_(bool) _recursion_flag_ = false; \
if (_recursion_flag_) \