diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2019-07-27 16:04:53 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2019-07-27 16:04:53 +0200 |
commit | 83e219bf89f19d656d5c9848511170745bbc5e9b (patch) | |
tree | 331115531e95f429db2004bdd424668e1b70e643 | |
parent | 0f06ef9a54a409a9f753a226d7a806b0fc17af9e (diff) | |
download | mariadb-git-bb-10.5-wlad-2.tar.gz |
MDEV-16424 - do not io_destroy while io_context is used by io_getenvbb-10.5-wlad-2
-rw-r--r-- | tpool/aio_linux.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc index 26fa43d45f4..76e4bec1ce3 100644 --- a/tpool/aio_linux.cc +++ b/tpool/aio_linux.cc @@ -20,7 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #include <assert.h> #include "tpool.h" #include <thread> - +#ifdef LINUX_NATIVE_AIO +#include <libaio.h> +#endif /* Linux AIO implementation, based on native AIO. Needs libaio.h and -laio at the compile time. @@ -34,7 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ namespace tpool { #ifdef LINUX_NATIVE_AIO -#include <libaio.h> struct linux_iocb : iocb { aiocb m_aiocb; @@ -64,7 +65,8 @@ class aio_linux : public aio for (;;) { io_event event; - int ret = io_getevents(aio->m_io_ctx, 1, 1, &event, nullptr); + struct timespec ts{0, 500000000}; + int ret = io_getevents(aio->m_io_ctx, 1, 1, &event, &ts); if (aio->m_in_shutdown) break; @@ -112,8 +114,8 @@ public: ~aio_linux() { m_in_shutdown = true; - io_destroy(m_io_ctx); m_getevent_thread.join(); + io_destroy(m_io_ctx); } // Inherited via aio |