The thread state is now a property of the worker
A worker's state is not statistics, but transient information.
This commit is contained in:
@ -27,6 +27,15 @@ class Worker : public MXS_WORKER
|
||||
Worker& operator = (const Worker&);
|
||||
|
||||
public:
|
||||
enum state_t
|
||||
{
|
||||
STOPPED,
|
||||
IDLE,
|
||||
POLLING,
|
||||
PROCESSING,
|
||||
ZPROCESSING
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the worker mechanism.
|
||||
*
|
||||
@ -54,6 +63,18 @@ public:
|
||||
return m_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of the worker.
|
||||
*
|
||||
* @return The current state.
|
||||
*
|
||||
* @attentions The state might have changed the moment after the function returns.
|
||||
*/
|
||||
state_t state() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file descriptor to the epoll instance of the worker.
|
||||
*
|
||||
@ -227,15 +248,11 @@ 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);
|
||||
void poll_waitevents(POLL_STATS* poll_stats, QUEUE_STATS* queue_stats);
|
||||
|
||||
private:
|
||||
int m_id; /*< The id of the worker. */
|
||||
state_t m_state; /*< The state of the worker */
|
||||
int m_epoll_fd; /*< The epoll file descriptor. */
|
||||
POLL_STATS* m_pPoll_stats; /*< Statistics for worker. */
|
||||
QUEUE_STATS* m_pQueue_stats; /*< Statistics for queue. */
|
||||
|
Reference in New Issue
Block a user