MDEV-33978 P_S.THREADS is not showing all server threads
This patch only makes sure Linux getevents thread is shown in PS
This commit is contained in:
parent
cc5d738999
commit
a2f510fccf
@ -102,6 +102,7 @@ class aio_linux final : public aio
|
|||||||
*/
|
*/
|
||||||
constexpr unsigned MAX_EVENTS= 256;
|
constexpr unsigned MAX_EVENTS= 256;
|
||||||
|
|
||||||
|
aio->m_pool->m_worker_init_callback();
|
||||||
io_event events[MAX_EVENTS];
|
io_event events[MAX_EVENTS];
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -110,14 +111,14 @@ class aio_linux final : public aio
|
|||||||
continue;
|
continue;
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
if (shutdown_in_progress)
|
if (shutdown_in_progress)
|
||||||
return;
|
goto end;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "io_getevents returned %d\n", ret);
|
fprintf(stderr, "io_getevents returned %d\n", ret);
|
||||||
abort();
|
abort();
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
for (int i= 0; i < ret; i++)
|
for (int i= 0; i < ret; i++)
|
||||||
{
|
{
|
||||||
@ -142,6 +143,8 @@ class aio_linux final : public aio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end:
|
||||||
|
aio->m_pool->m_worker_destroy_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -92,7 +92,9 @@ public:
|
|||||||
|
|
||||||
static void aio_completion_thread_proc(tpool_generic_win_aio* aio)
|
static void aio_completion_thread_proc(tpool_generic_win_aio* aio)
|
||||||
{
|
{
|
||||||
|
aio->m_pool->m_worker_init_callback();
|
||||||
aio->completion_thread_work();
|
aio->completion_thread_work();
|
||||||
|
aio->m_pool->m_worker_destroy_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
~tpool_generic_win_aio()
|
~tpool_generic_win_aio()
|
||||||
|
@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Windows-specific native file handle struct.
|
Windows-specific native file handle struct.
|
||||||
Apart from the actual handle, contains PTP_IO
|
Apart from the actual handle, contains PTP_IO
|
||||||
@ -202,21 +204,24 @@ protected:
|
|||||||
std::unique_ptr<aio> m_aio;
|
std::unique_ptr<aio> m_aio;
|
||||||
virtual aio *create_native_aio(int max_io)= 0;
|
virtual aio *create_native_aio(int max_io)= 0;
|
||||||
|
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
Functions to be called at worker thread start/end
|
Functions to be called at worker thread start/end
|
||||||
can be used for example to set some TLS variables
|
can be used for example to set some TLS variables
|
||||||
*/
|
*/
|
||||||
void (*m_worker_init_callback)(void);
|
void (*m_worker_init_callback)(void)= [] {};
|
||||||
void (*m_worker_destroy_callback)(void);
|
void (*m_worker_destroy_callback)(void)= [] {};
|
||||||
|
|
||||||
public:
|
thread_pool()
|
||||||
thread_pool() : m_aio(), m_worker_init_callback(), m_worker_destroy_callback()
|
: m_aio()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void submit_task(task *t)= 0;
|
virtual void submit_task(task *t)= 0;
|
||||||
virtual timer* create_timer(callback_func func, void *data=nullptr) = 0;
|
virtual timer* create_timer(callback_func func, void *data=nullptr) = 0;
|
||||||
void set_thread_callbacks(void (*init)(), void (*destroy)())
|
void set_thread_callbacks(void (*init)(), void (*destroy)())
|
||||||
{
|
{
|
||||||
|
assert(init);
|
||||||
|
assert(destroy);
|
||||||
m_worker_init_callback= init;
|
m_worker_init_callback= init;
|
||||||
m_worker_destroy_callback= destroy;
|
m_worker_destroy_callback= destroy;
|
||||||
}
|
}
|
||||||
|
@ -571,8 +571,7 @@ void thread_pool_generic::worker_main(worker_data *thread_var)
|
|||||||
{
|
{
|
||||||
task* task;
|
task* task;
|
||||||
set_tls_pool(this);
|
set_tls_pool(this);
|
||||||
if(m_worker_init_callback)
|
m_worker_init_callback();
|
||||||
m_worker_init_callback();
|
|
||||||
|
|
||||||
tls_worker_data = thread_var;
|
tls_worker_data = thread_var;
|
||||||
|
|
||||||
@ -581,8 +580,7 @@ void thread_pool_generic::worker_main(worker_data *thread_var)
|
|||||||
task->execute();
|
task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_worker_destroy_callback)
|
m_worker_destroy_callback();
|
||||||
m_worker_destroy_callback();
|
|
||||||
|
|
||||||
worker_end(thread_var);
|
worker_end(thread_var);
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,7 @@ class thread_pool_win : public thread_pool
|
|||||||
if (!m_pool)
|
if (!m_pool)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_pool->m_worker_destroy_callback)
|
m_pool->m_worker_destroy_callback();
|
||||||
m_pool->m_worker_destroy_callback();
|
|
||||||
|
|
||||||
m_pool->m_thread_count--;
|
m_pool->m_thread_count--;
|
||||||
}
|
}
|
||||||
/** This needs to be called before every IO or simple task callback.*/
|
/** This needs to be called before every IO or simple task callback.*/
|
||||||
@ -63,8 +61,7 @@ class thread_pool_win : public thread_pool
|
|||||||
m_pool = pool;
|
m_pool = pool;
|
||||||
m_pool->m_thread_count++;
|
m_pool->m_thread_count++;
|
||||||
// Call the thread init function.
|
// Call the thread init function.
|
||||||
if (m_pool->m_worker_init_callback)
|
m_pool->m_worker_init_callback();
|
||||||
m_pool->m_worker_init_callback();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user