diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-19 13:49:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-19 13:49:52 +0300 |
commit | d1edb011eead8401bf14c8d1e90a6fb3f2a4d6e9 (patch) | |
tree | be790548e486e06aff1b346aeb6641a279ffb899 /storage | |
parent | 7da351d8047087fc589f2f6cdd49b0b3647043f5 (diff) | |
download | mariadb-git-d1edb011eead8401bf14c8d1e90a6fb3f2a4d6e9.tar.gz |
Cleanup: Remove os0thread
Let us use the common pthread_t wrapper for Microsoft Windows.
This fixes up commit dbe941e06fe51fe0ff30dff5f1ae62960ff4fc61
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/CMakeLists.txt | 4 | ||||
-rw-r--r-- | storage/innobase/buf/buf0dump.cc | 3 | ||||
-rw-r--r-- | storage/innobase/include/dict0mem.h | 12 | ||||
-rw-r--r-- | storage/innobase/include/dict0stats_bg.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 8 | ||||
-rw-r--r-- | storage/innobase/include/lock0lock.h | 12 | ||||
-rw-r--r-- | storage/innobase/include/os0thread.h | 42 | ||||
-rw-r--r-- | storage/innobase/include/sux_lock.h | 45 | ||||
-rw-r--r-- | storage/innobase/include/trx0trx.h | 10 | ||||
-rw-r--r-- | storage/innobase/include/ut0counter.h | 4 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 4 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 1 | ||||
-rw-r--r-- | storage/innobase/os/os0thread.cc | 28 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 2 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 1 | ||||
-rw-r--r-- | storage/innobase/trx/trx0purge.cc | 3 | ||||
-rw-r--r-- | storage/innobase/ut/ut0ut.cc | 5 |
17 files changed, 54 insertions, 133 deletions
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index aee68b8460d..83d737f88ca 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2014, 2021, MariaDB Corporation. +# Copyright (c) 2014, 2022, MariaDB Corporation. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -186,7 +186,6 @@ SET(INNOBASE_SOURCES include/mtr0types.h include/os0file.h include/os0file.inl - include/os0thread.h include/page0cur.h include/page0cur.inl include/page0page.h @@ -283,7 +282,6 @@ SET(INNOBASE_SOURCES mem/mem0mem.cc mtr/mtr0mtr.cc os/os0file.cc - os/os0thread.cc page/page0cur.cc page/page0page.cc page/page0zip.cc diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index 96b046c93bc..770bb74c90a 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -35,7 +35,6 @@ Created April 08, 2011 Vasil Dimov #include "buf0dump.h" #include "dict0dict.h" #include "os0file.h" -#include "os0thread.h" #include "srv0srv.h" #include "srv0start.h" #include "ut0byte.h" diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index d2f090f0ae4..e8233ee18e5 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1952,10 +1952,10 @@ struct dict_table_t { #ifdef UNIV_DEBUG /** @return whether the current thread holds the lock_mutex */ bool lock_mutex_is_owner() const - { return lock_mutex_owner == os_thread_get_curr_id(); } + { return lock_mutex_owner == pthread_self(); } /** @return whether the current thread holds the stats_mutex (lock_mutex) */ bool stats_mutex_is_owner() const - { return lock_mutex_owner == os_thread_get_curr_id(); } + { return lock_mutex_owner == pthread_self(); } #endif /* UNIV_DEBUG */ void lock_mutex_init() { lock_mutex.init(); } void lock_mutex_destroy() { lock_mutex.destroy(); } @@ -1964,20 +1964,20 @@ struct dict_table_t { { ut_ad(!lock_mutex_is_owner()); lock_mutex.wr_lock(); - ut_ad(!lock_mutex_owner.exchange(os_thread_get_curr_id())); + ut_ad(!lock_mutex_owner.exchange(pthread_self())); } /** Try to acquire lock_mutex */ bool lock_mutex_trylock() { ut_ad(!lock_mutex_is_owner()); bool acquired= lock_mutex.wr_lock_try(); - ut_ad(!acquired || !lock_mutex_owner.exchange(os_thread_get_curr_id())); + ut_ad(!acquired || !lock_mutex_owner.exchange(pthread_self())); return acquired; } /** Release lock_mutex */ void lock_mutex_unlock() { - ut_ad(lock_mutex_owner.exchange(0) == os_thread_get_curr_id()); + ut_ad(lock_mutex_owner.exchange(0) == pthread_self()); lock_mutex.wr_unlock(); } #ifndef SUX_LOCK_GENERIC @@ -2279,7 +2279,7 @@ private: srw_spin_mutex lock_mutex; #ifdef UNIV_DEBUG /** The owner of lock_mutex (0 if none) */ - Atomic_relaxed<os_thread_id_t> lock_mutex_owner{0}; + Atomic_relaxed<pthread_t> lock_mutex_owner{0}; #endif public: /** Autoinc counter value to give to the next inserted row. */ diff --git a/storage/innobase/include/dict0stats_bg.h b/storage/innobase/include/dict0stats_bg.h index f047d404693..e02b9835099 100644 --- a/storage/innobase/include/dict0stats_bg.h +++ b/storage/innobase/include/dict0stats_bg.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,7 +28,6 @@ Created Apr 26, 2012 Vasil Dimov #define dict0stats_bg_h #include "dict0types.h" -#include "os0thread.h" #ifdef HAVE_PSI_INTERFACE extern mysql_pfs_key_t recalc_pool_mutex_key; diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 2041b857a48..9df3a260152 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -412,7 +412,7 @@ private: static constexpr uint32_t PENDING= ~(STOPPING | CLOSING | NEEDS_FSYNC); /** latch protecting all page allocation bitmap pages */ srw_lock latch; - os_thread_id_t latch_owner; + pthread_t latch_owner; ut_d(Atomic_relaxed<uint32_t> latch_count;) public: /** MariaDB encryption data */ @@ -1040,20 +1040,20 @@ public: #ifdef UNIV_DEBUG bool is_latched() const { return latch_count != 0; } #endif - bool is_owner() const { return latch_owner == os_thread_get_curr_id(); } + bool is_owner() const { return latch_owner == pthread_self(); } /** Acquire the allocation latch in exclusive mode */ void x_lock() { latch.wr_lock(SRW_LOCK_CALL); ut_ad(!latch_owner); - latch_owner= os_thread_get_curr_id(); + latch_owner= pthread_self(); ut_ad(!latch_count.fetch_add(1)); } /** Release the allocation latch from exclusive mode */ void x_unlock() { ut_ad(latch_count.fetch_sub(1) == 1); - ut_ad(latch_owner == os_thread_get_curr_id()); + ut_ad(latch_owner == pthread_self()); latch_owner= 0; latch.wr_unlock(); } diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index e711bf03444..776d9ec9f99 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -687,7 +687,7 @@ private: alignas(CPU_LEVEL1_DCACHE_LINESIZE) srw_spin_lock latch; #ifdef UNIV_DEBUG /** The owner of exclusive latch (0 if none); protected by latch */ - std::atomic<os_thread_id_t> writer{0}; + std::atomic<pthread_t> writer{0}; /** Number of shared latches */ std::atomic<ulint> readers{0}; #endif @@ -751,14 +751,14 @@ public: mysql_mutex_assert_not_owner(&wait_mutex); ut_ad(!is_writer()); latch.wr_lock(); - ut_ad(!writer.exchange(os_thread_get_curr_id(), + ut_ad(!writer.exchange(pthread_self(), std::memory_order_relaxed)); } /** Release exclusive lock_sys.latch */ void wr_unlock() { ut_ad(writer.exchange(0, std::memory_order_relaxed) == - os_thread_get_curr_id()); + pthread_self()); latch.wr_unlock(); } /** Acquire shared lock_sys.latch */ @@ -784,7 +784,7 @@ public: { ut_ad(!is_writer()); if (!latch.wr_lock_try()) return false; - ut_ad(!writer.exchange(os_thread_get_curr_id(), + ut_ad(!writer.exchange(pthread_self(), std::memory_order_relaxed)); return true; } @@ -808,9 +808,9 @@ public: bool is_writer() const { # ifdef SUX_LOCK_GENERIC - return writer.load(std::memory_order_relaxed) == os_thread_get_curr_id(); + return writer.load(std::memory_order_relaxed) == pthread_self(); # else - return writer.load(std::memory_order_relaxed) == os_thread_get_curr_id() || + return writer.load(std::memory_order_relaxed) == pthread_self() || (xtest() && !latch.is_locked_or_waiting()); # endif } diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h deleted file mode 100644 index b2971462a70..00000000000 --- a/storage/innobase/include/os0thread.h +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/os0thread.h -The interface to the operating system -process and thread control primitives - -Created 9/8/1995 Heikki Tuuri -*******************************************************/ - -#pragma once -#include "univ.i" - -#ifdef _WIN32 -typedef DWORD os_thread_id_t; /*!< In Windows the thread id - is an unsigned long int */ -#else - -typedef pthread_t os_thread_id_t; /*!< In Unix we use the thread - handle itself as the id of - the thread */ -#endif /* _WIN32 */ - -#define os_thread_eq(a,b) IF_WIN(a == b, pthread_equal(a, b)) -#define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self()) diff --git a/storage/innobase/include/sux_lock.h b/storage/innobase/include/sux_lock.h index 17a484c732e..2c0167ac651 100644 --- a/storage/innobase/include/sux_lock.h +++ b/storage/innobase/include/sux_lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2021, MariaDB Corporation. +Copyright (c) 2020, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -19,7 +19,6 @@ this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "srw_lock.h" #include "my_atomic_wrapper.h" -#include "os0thread.h" #ifdef UNIV_DEBUG # include <unordered_set> #endif @@ -36,19 +35,19 @@ class sux_lock final /** Numbers of U and X locks. Protected by lock. */ uint32_t recursive; /** The owner of the U or X lock (0 if none); protected by lock */ - std::atomic<os_thread_id_t> writer; + std::atomic<pthread_t> writer; /** Special writer!=0 value to indicate that the lock is non-recursive and will be released by an I/O thread */ #if defined __linux__ || defined _WIN32 - static constexpr os_thread_id_t FOR_IO= os_thread_id_t(~0UL); + static constexpr pthread_t FOR_IO= pthread_t(~0UL); #else -# define FOR_IO ((os_thread_id_t) ~0UL) /* it could be a pointer */ +# define FOR_IO ((pthread_t) ~0UL) /* it could be a pointer */ #endif #ifdef UNIV_DEBUG /** Protects readers */ mutable srw_mutex readers_lock; /** Threads that hold the lock in shared mode */ - std::atomic<std::unordered_multiset<os_thread_id_t>*> readers; + std::atomic<std::unordered_multiset<pthread_t>*> readers; #endif /** The multiplier in recursive for X locks */ @@ -109,7 +108,7 @@ public: /** Acquire a recursive lock */ template<bool allow_readers> void writer_recurse() { - ut_ad(writer == os_thread_get_curr_id()); + ut_ad(writer == pthread_self()); ut_d(auto rec= (recursive / (allow_readers ? RECURSIVE_U : RECURSIVE_X)) & RECURSIVE_MAX); ut_ad(allow_readers ? recursive : rec); @@ -120,14 +119,14 @@ public: private: /** Transfer the ownership of a write lock to another thread @param id the new owner of the U or X lock */ - void set_new_owner(os_thread_id_t id) + void set_new_owner(pthread_t id) { IF_DBUG(DBUG_ASSERT(writer.exchange(id, std::memory_order_relaxed)), writer.store(id, std::memory_order_relaxed)); } /** Assign the ownership of a write lock to a thread @param id the owner of the U or X lock */ - void set_first_owner(os_thread_id_t id) + void set_first_owner(pthread_t id) { IF_DBUG(DBUG_ASSERT(!writer.exchange(id, std::memory_order_relaxed)), writer.store(id, std::memory_order_relaxed)); @@ -136,12 +135,12 @@ private: /** Register the current thread as a holder of a shared lock */ void s_lock_register() { - const os_thread_id_t id= os_thread_get_curr_id(); + const pthread_t id= pthread_self(); readers_lock.wr_lock(); auto r= readers.load(std::memory_order_relaxed); if (!r) { - r= new std::unordered_multiset<os_thread_id_t>(); + r= new std::unordered_multiset<pthread_t>(); readers.store(r, std::memory_order_relaxed); } r->emplace(id); @@ -152,12 +151,12 @@ private: public: /** In crash recovery or the change buffer, claim the ownership of the exclusive block lock to the current thread */ - void claim_ownership() { set_new_owner(os_thread_get_curr_id()); } + void claim_ownership() { set_new_owner(pthread_self()); } /** @return whether the current thread is holding X or U latch */ bool have_u_or_x() const { - if (os_thread_get_curr_id() != writer.load(std::memory_order_relaxed)) + if (pthread_self() != writer.load(std::memory_order_relaxed)) return false; ut_ad(recursive); return true; @@ -175,7 +174,7 @@ public: if (auto r= readers.load(std::memory_order_relaxed)) { readers_lock.wr_lock(); - bool found= r->find(os_thread_get_curr_id()) != r->end(); + bool found= r->find(pthread_self()) != r->end(); readers_lock.wr_unlock(); return found; } @@ -233,7 +232,7 @@ public: void s_unlock() { #ifdef UNIV_DEBUG - const os_thread_id_t id= os_thread_get_curr_id(); + const pthread_t id= pthread_self(); auto r= readers.load(std::memory_order_relaxed); ut_ad(r); readers_lock.wr_lock(); @@ -250,7 +249,7 @@ public: void u_or_x_unlock(bool allow_readers, bool claim_ownership= false) { ut_d(auto owner= writer.load(std::memory_order_relaxed)); - ut_ad(owner == os_thread_get_curr_id() || + ut_ad(owner == pthread_self() || (owner == FOR_IO && claim_ownership && recursive == (allow_readers ? RECURSIVE_U : RECURSIVE_X))); ut_d(auto rec= (recursive / (allow_readers ? RECURSIVE_U : RECURSIVE_X)) & @@ -314,7 +313,7 @@ inline void sux_lock<ssux_lock>::s_lock(const char *file, unsigned line) template<> inline void sux_lock<ssux_lock>::u_lock(const char *file, unsigned line) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) writer_recurse<true>(); else @@ -329,7 +328,7 @@ inline void sux_lock<ssux_lock>::u_lock(const char *file, unsigned line) template<> inline void sux_lock<ssux_lock>::x_lock(const char *file, unsigned line) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) writer_recurse<false>(); else @@ -371,7 +370,7 @@ inline void sux_lock<ssux>::unlock_shared() { s_unlock(); } template<typename ssux> inline void sux_lock<ssux>::u_lock() { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) writer_recurse<true>(); else @@ -385,7 +384,7 @@ template<typename ssux> inline void sux_lock<ssux>::u_lock() template<typename ssux> inline void sux_lock<ssux>::x_lock(bool for_io) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { ut_ad(!for_io); @@ -409,7 +408,7 @@ template<typename ssux> inline void sux_lock<ssux>::u_x_upgrade() template<typename ssux> inline bool sux_lock<ssux>::x_lock_upgraded() { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { ut_ad(recursive); @@ -436,7 +435,7 @@ template<typename ssux> inline bool sux_lock<ssux>::x_lock_upgraded() template<typename ssux> inline bool sux_lock<ssux>::u_lock_try(bool for_io) { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { if (for_io) @@ -456,7 +455,7 @@ template<typename ssux> inline bool sux_lock<ssux>::u_lock_try(bool for_io) template<typename ssux> inline bool sux_lock<ssux>::x_lock_try() { - os_thread_id_t id= os_thread_get_curr_id(); + pthread_t id= pthread_self(); if (writer.load(std::memory_order_relaxed) == id) { writer_recurse<false>(); diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 2fd04353a2b..d480cac25c8 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -522,7 +522,7 @@ no longer be associated with a session when the server is restarted. A session may be served by at most one thread at a time. The serving thread of a session might change in some MySQL implementations. -Therefore we do not have os_thread_get_curr_id() assertions in the code. +Therefore we do not have pthread_self() assertions in the code. Normally, only the thread that is currently associated with a running transaction may access (read and modify) the trx object, and it may do @@ -601,7 +601,7 @@ private: srw_spin_mutex mutex; #ifdef UNIV_DEBUG /** The owner of mutex (0 if none); protected by mutex */ - std::atomic<os_thread_id_t> mutex_owner{0}; + std::atomic<pthread_t> mutex_owner{0}; #endif /* UNIV_DEBUG */ public: void mutex_init() { mutex.init(); } @@ -612,14 +612,14 @@ public: { ut_ad(!mutex_is_owner()); mutex.wr_lock(); - ut_ad(!mutex_owner.exchange(os_thread_get_curr_id(), + ut_ad(!mutex_owner.exchange(pthread_self(), std::memory_order_relaxed)); } /** Release the mutex */ void mutex_unlock() { ut_ad(mutex_owner.exchange(0, std::memory_order_relaxed) - == os_thread_get_curr_id()); + == pthread_self()); mutex.wr_unlock(); } #ifndef SUX_LOCK_GENERIC @@ -630,7 +630,7 @@ public: bool mutex_is_owner() const { return mutex_owner.load(std::memory_order_relaxed) == - os_thread_get_curr_id(); + pthread_self(); } #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/ut0counter.h b/storage/innobase/include/ut0counter.h index 94a674b2c32..d6589cc4fd3 100644 --- a/storage/innobase/include/ut0counter.h +++ b/storage/innobase/include/ut0counter.h @@ -28,7 +28,7 @@ Created 2012/04/12 by Sunny Bains #ifndef ut0counter_h #define ut0counter_h -#include "os0thread.h" +#include "univ.i" #include "my_rdtsc.h" /** Use the result of my_timer_cycles(), which mainly uses RDTSC for cycles @@ -46,7 +46,7 @@ get_rnd_value() /* We may go here if my_timer_cycles() returns 0, so we have to have the plan B for the counter. */ #if !defined(_WIN32) - return (size_t)os_thread_get_curr_id(); + return (size_t)pthread_self(); #else LARGE_INTEGER cnt; QueryPerformanceCounter(&cnt); diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 05fdf9b3efe..617a055b3be 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -418,13 +418,13 @@ void lock_sys_t::wr_lock(const char *file, unsigned line) { mysql_mutex_assert_not_owner(&wait_mutex); latch.wr_lock(file, line); - ut_ad(!writer.exchange(os_thread_get_curr_id(), std::memory_order_relaxed)); + ut_ad(!writer.exchange(pthread_self(), std::memory_order_relaxed)); } /** Release exclusive lock_sys.latch */ void lock_sys_t::wr_unlock() { ut_ad(writer.exchange(0, std::memory_order_relaxed) == - os_thread_get_curr_id()); + pthread_self()); latch.wr_unlock(); } diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 4f76cfa8480..d8160473bf5 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -50,7 +50,6 @@ Created 10/21/1995 Heikki Tuuri #ifdef HAVE_LINUX_UNISTD_H #include "unistd.h" #endif -#include "os0thread.h" #include "buf0dblwr.h" #include <tpool_structs.h> diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc deleted file mode 100644 index a5158ef825d..00000000000 --- a/storage/innobase/os/os0thread.cc +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file os/os0thread.cc -The interface to the operating system thread control primitives - -Created 9/8/1995 Heikki Tuuri -*******************************************************/ - -#include "univ.i" -#include "srv0srv.h" diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 978a0a92200..0cc3878c2fe 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -485,7 +485,7 @@ priority of the background thread so that it will be scheduled and it can release the resource. This solution is called priority inheritance in real-time programming. A drawback of this solution is that the overhead of acquiring a mutex increases slightly, maybe 0.2 microseconds on a 100 -MHz Pentium, because the thread has to call os_thread_get_curr_id. This may +MHz Pentium, because the thread has to call pthread_self. This may be compared to 0.5 microsecond overhead for a mutex lock-unlock pair. Note that the thread cannot store the information in the resource , say mutex, itself, because competing threads could wipe out the information if it is diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index cab8bb648e3..a3790eef32f 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -55,7 +55,6 @@ Created 2/16/1996 Heikki Tuuri #include "buf0dblwr.h" #include "buf0dump.h" #include "os0file.h" -#include "os0thread.h" #include "fil0fil.h" #include "fil0crypt.h" #include "fsp0fsp.h" diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index d45f23ea1ea..f5d8c66353a 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -29,7 +29,6 @@ Created 3/26/1996 Heikki Tuuri #include "fut0fut.h" #include "mach0data.h" #include "mtr0log.h" -#include "os0thread.h" #include "que0que.h" #include "row0purge.h" #include "row0upd.h" @@ -1093,7 +1092,7 @@ trx_purge_fetch_next_rec( } /* fprintf(stderr, "Thread %lu purging trx %llu undo record %llu\n", - os_thread_get_curr_id(), iter->trx_no, iter->undo_no); */ + pthread_self(), iter->trx_no, iter->undo_no); */ *roll_ptr = trx_undo_build_roll_ptr( /* row_purge_record_func() will later set diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index d49fa9fb16c..5542d5410c2 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -32,7 +32,6 @@ Created 5/11/1994 Heikki Tuuri #ifndef UNIV_INNOCHECKSUM #include <mysql_com.h> -#include "os0thread.h" #include "ut0ut.h" #include "trx0trx.h" #include <string> @@ -92,7 +91,7 @@ ut_print_timestamp( #ifdef UNIV_INNOCHECKSUM ulint{0} #else - ulint(os_thread_get_curr_id()) + ulint(pthread_self()) #endif ); } |