poll_waitevents moved to Worker

A direct move without any non-essential modifications. Poll_waitevents will
be turned into a regular methods using instance variables.
This commit is contained in:
Johan Wikman
2017-04-18 12:37:07 +03:00
parent 4ed615a6c1
commit effa2f5674
4 changed files with 234 additions and 184 deletions

View File

@ -13,6 +13,7 @@
*/
#include <maxscale/cppdefs.hh>
#include <maxscale/platform.h>
#include "messagequeue.hh"
#include "worker.h"
@ -196,6 +197,21 @@ public:
*/
static int get_current_id();
/**
* Set the number of non-blocking poll cycles that will be done before
* a blocking poll will take place.
*
* @param nbpolls Number of non-blocking polls to perform before blocking.
*/
static void set_nonblocking_polls(unsigned int nbpolls);
/**
* Maximum time to block in epoll_wait.
*
* @param maxwait Maximum wait time in millliseconds.
*/
static void set_maxwait(unsigned int maxwait);
private:
Worker(int id,
int epoll_fd,
@ -211,6 +227,13 @@ private:
static void thread_main(void* arg);
static void poll_waitevents(int epoll_fd,
int thread_id,
POLL_STATS* poll_stats,
QUEUE_STATS* queue_stats,
bool (*should_shutdown)(void* data),
void* data);
private:
int m_id; /*< The id of the worker. */
int m_epoll_fd; /*< The epoll file descriptor. */