summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-30 13:59:20 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-30 13:59:20 +0200
commite34e53b554e8c3e05e3bd918204cf7ba494b1ae3 (patch)
treea8eac9320ea5fbb9c3c1064194e62ceeb98421d6
parent8fa6e363754b8dc3c8f75eee3dbe2e25fa79f0ac (diff)
downloadmariadb-git-e34e53b554e8c3e05e3bd918204cf7ba494b1ae3.tar.gz
MDEV-24308: Revert for Windows
For some reason, InnoDB debug tests on Windows fail due to rw_lock_t if the function call overhead for some os_thread_ code is removed. This change worked fine on Windows in combination with MDEV-24142.
-rw-r--r--storage/innobase/include/os0thread.h12
-rw-r--r--storage/innobase/os/os0thread.cc6
2 files changed, 15 insertions, 3 deletions
diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h
index 8b293972c13..ed989045f18 100644
--- a/storage/innobase/include/os0thread.h
+++ b/storage/innobase/include/os0thread.h
@@ -66,9 +66,15 @@ typedef void* (*os_posix_f_t) (void*);
typedef unsigned int mysql_pfs_key_t;
#endif /* HAVE_PSI_INTERFACE */
-#define os_thread_eq(a,b) IF_WIN(a == b, pthread_equal(a, b))
-#define os_thread_yield() IF_WIN(SwitchToThread(), sched_yield())
-#define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self())
+#ifndef _WIN32
+#define os_thread_eq(a,b) pthread_equal(a, b)
+#define os_thread_yield() sched_yield()
+#define os_thread_get_curr_id() pthread_self()
+#else
+bool os_thread_eq(os_thread_id_t a, os_thread_id_t b);
+void os_thread_yield();
+os_thread_id_t os_thread_get_curr_id();
+#endif
/****************************************************************//**
Creates a new thread of execution. The execution starts from
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index 2c5e20941e3..f3533acfaac 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -27,6 +27,12 @@ Created 9/8/1995 Heikki Tuuri
#include "univ.i"
#include "srv0srv.h"
+#ifdef _WIN32
+bool os_thread_eq(os_thread_id_t a, os_thread_id_t b) { return a == b; }
+void os_thread_yield() { SwitchToThread(); }
+os_thread_id_t os_thread_get_curr_id() { return GetCurrentThreadId(); }
+#endif
+
/****************************************************************//**
Creates a new thread of execution. The execution starts from
the function given.