Turn worker into a C++ class
This is the first step in turning the worker mechanism and everything around it into a set of C++ classes. In this change, the original C API is still present, but in subsequent changes that will be removed.
This commit is contained in:
@ -20,14 +20,14 @@ MXS_BEGIN_DECLS
|
||||
|
||||
typedef struct mxs_worker
|
||||
{
|
||||
MXS_POLL_DATA poll; /*< The poll data used by the polling mechanism. */
|
||||
int id; /*< The id of the worker. */
|
||||
int read_fd; /*< The file descriptor the worked reads from. */
|
||||
int write_fd; /*< The file descriptor used for sending data to the worker. */
|
||||
THREAD thread; /*< The thread handle of the worker. */
|
||||
bool started; /*< Whether the thread has been started or not. */
|
||||
bool should_shutdown; /*< Whether shutdown should be performed. */
|
||||
bool shutdown_initiated; /*< Whether shutdown has been initated. */
|
||||
MXS_POLL_DATA m_poll; /*< The poll data used by the polling mechanism. */
|
||||
int m_id; /*< The id of the worker. */
|
||||
int m_read_fd; /*< The file descriptor the worked reads from. */
|
||||
int m_write_fd; /*< The file descriptor used for sending data to the worker. */
|
||||
THREAD m_thread; /*< The thread handle of the worker. */
|
||||
bool m_started; /*< Whether the thread has been started or not. */
|
||||
bool m_should_shutdown; /*< Whether shutdown should be performed. */
|
||||
bool m_shutdown_initiated; /*< Whether shutdown has been initated. */
|
||||
} MXS_WORKER;
|
||||
|
||||
enum mxs_worker_msg_id
|
||||
@ -91,9 +91,9 @@ int mxs_worker_get_current_id();
|
||||
*
|
||||
* @return The id of the worker.
|
||||
*/
|
||||
static inline int mxs_worker_id(MXS_WORKER* worker)
|
||||
static inline int mxs_worker_id(MXS_WORKER* pWorker)
|
||||
{
|
||||
return worker->id;
|
||||
return pWorker->m_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user