MXS-1754 Rename mxs::Worker to mxs::RoutingWorker

A new class mxs::Worker will be introduced and mxs::RoutingWorker
will be inherited from that. mxs::Worker will basically only be a
thread with a message-loop.

Once available, all current non-worker threads (but the one
implicitly created by microhttpd) can be creating by inheriting
from that; in practice that means the housekeeping thread, all
monitor threads and possibly the logging thread.

The benefit of this arrangement is that there then will be a general
mechanism for cross thread communication without having to use any
shared data structures.
This commit is contained in:
Johan Wikman
2018-04-12 13:04:54 +03:00
parent fa3143cedf
commit 230876cd69
15 changed files with 140 additions and 138 deletions

View File

@ -17,7 +17,7 @@
namespace maxscale
{
class Worker;
class RoutingWorker;
/**
* A WorkerTask represents a task to be performed by a Worker.
@ -38,7 +38,7 @@ public:
* @attention As the function is called by a worker, the body of `execute`
* should execute quickly and not perform any blocking operations.
*/
virtual void execute(Worker& worker) = 0;
virtual void execute(RoutingWorker& worker) = 0;
};
/**
@ -69,10 +69,10 @@ protected:
* @attention As the function is called by a worker, the body of `execute`
* should execute quickly and not perform any blocking operations.
*/
virtual void execute(Worker& worker) = 0;
virtual void execute(RoutingWorker& worker) = 0;
private:
friend class Worker;
friend class RoutingWorker;
void inc_ref();
void dec_ref();