diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-12-03 08:44:49 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-12-03 11:05:18 +0200 |
commit | 57444a3b3086e96272cf10c3749c5ddb5f990492 (patch) | |
tree | 65e5616d80af04e1cc37d8d8d6db43142c3756e7 /tpool | |
parent | cd92c6c83dd92cee2ccccd107988da032b2026f8 (diff) | |
download | mariadb-git-57444a3b3086e96272cf10c3749c5ddb5f990492.tar.gz |
MDEV-16264: Minor cleanup
aio_linux::m_max_io_count: Unused data member; remove.
aiocb::m_ret_len: Declare as the more compatible type size_t.
Unfortunately, ssize_t is not available on Microsoft Visual Studio.
Diffstat (limited to 'tpool')
-rw-r--r-- | tpool/aio_linux.cc | 9 | ||||
-rw-r--r-- | tpool/aio_simulated.cc | 11 | ||||
-rw-r--r-- | tpool/tpool.h | 3 |
3 files changed, 12 insertions, 11 deletions
diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc index 0a4820a2412..24bc04c75ba 100644 --- a/tpool/aio_linux.cc +++ b/tpool/aio_linux.cc @@ -39,7 +39,6 @@ namespace tpool class aio_linux : public aio { - int m_max_io_count; thread_pool* m_pool; io_context_t m_io_ctx; bool m_in_shutdown; @@ -62,7 +61,7 @@ class aio_linux : public aio long long res = event.res; if (res < 0) { - iocb->m_err = -res; + iocb->m_err = static_cast<int>(-res); iocb->m_ret_len = 0; } else @@ -93,8 +92,8 @@ class aio_linux : public aio } public: - aio_linux(io_context_t ctx, thread_pool* pool, size_t max_count) - : m_max_io_count(max_count), m_pool(pool), m_io_ctx(ctx), + aio_linux(io_context_t ctx, thread_pool* pool) + : m_pool(pool), m_io_ctx(ctx), m_in_shutdown(), m_getevent_thread(getevent_thread_routine, this) { } @@ -146,7 +145,7 @@ aio* create_linux_aio(thread_pool* pool, int max_io) fprintf(stderr, "io_setup(%d) returned %d\n", max_io, ret); return nullptr; } - return new aio_linux(ctx, pool, max_io); + return new aio_linux(ctx, pool); } #else aio* create_linux_aio(thread_pool* pool, int max_aio) diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc index 7deaf745aa2..4811797a75e 100644 --- a/tpool/aio_simulated.cc +++ b/tpool/aio_simulated.cc @@ -133,7 +133,11 @@ public: static void simulated_aio_callback(void *param) { aiocb *cb= (aiocb *) param; - int ret_len; +#ifdef _WIN32 + size_t ret_len; +#else + ssize_t ret_len; +#endif int err= 0; switch (cb->m_opcode) { @@ -146,14 +150,13 @@ public: default: abort(); } - if (ret_len < 0) - { #ifdef _WIN32 + if (static_cast<int>(ret_len) < 0) err= GetLastError(); #else + if (ret_len < 0) err= errno; #endif - } cb->m_ret_len = ret_len; cb->m_err = err; cb->m_callback(cb); diff --git a/tpool/tpool.h b/tpool/tpool.h index ad63e25bdd7..8659e8adc74 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -110,7 +110,6 @@ enum class aio_opcode AIO_PWRITE }; const int MAX_AIO_USERDATA_LEN= 40; -struct aiocb; /** IO control block, includes parameters for the IO, and the callback*/ @@ -129,7 +128,7 @@ struct aiocb callback_func m_callback; task_group* m_group; /* Returned length and error code*/ - int m_ret_len; + size_t m_ret_len; int m_err; void *m_internal; task m_internal_task; |