All worker data moved to Worker class

With the exception of the poll structure.
This commit is contained in:
Johan Wikman
2017-04-05 14:33:16 +03:00
parent 72eadff181
commit df5553c35a
3 changed files with 16 additions and 18 deletions

View File

@ -63,11 +63,12 @@ static bool modules_thread_init();
static void modules_thread_finish();
Worker::Worker(int id, int read_fd, int write_fd)
: m_id(id)
, m_read_fd(read_fd)
, m_write_fd(write_fd)
{
m_poll.handler = &Worker::poll_handler;
m_id = id;
m_read_fd = read_fd;
m_write_fd = write_fd;
m_thread = 0;
m_started = false;
m_should_shutdown = false;
@ -115,6 +116,16 @@ void Worker::finish()
}
}
int mxs_worker_id(MXS_WORKER* pWorker)
{
return static_cast<Worker*>(pWorker)->id();
}
bool mxs_worker_should_shutdown(MXS_WORKER* pWorker)
{
return static_cast<Worker*>(pWorker)->should_shutdown();
}
Worker* Worker::get(int worker_id)
{
ss_dassert(worker_id < this_unit.n_workers);