MXS-2008 Move maxscale/worker.h to maxbase/worker.h

This commit is contained in:
Johan Wikman
2018-08-17 15:37:00 +03:00
parent 932956d5f6
commit e0cb11151f
10 changed files with 49 additions and 54 deletions

View File

@ -13,8 +13,8 @@
*/
#include <maxscale/cdefs.h>
#include <maxbase/worker.h>
#include <maxscale/session.h>
#include <maxscale/worker.h>
MXS_BEGIN_DECLS
@ -31,14 +31,14 @@ MXS_BEGIN_DECLS
* @return The corresponding routing worker instance, or NULL if the
* id does not correspond to a routing worker.
*/
MXS_WORKER* mxs_rworker_get(int worker_id);
MXB_WORKER* mxs_rworker_get(int worker_id);
/**
* Return the current routing worker.
*
* @return A routing worker, or NULL if there is no current routing worker.
*/
MXS_WORKER* mxs_rworker_get_current();
MXB_WORKER* mxs_rworker_get_current();
/**
* Return the id of the current routing worker.

View File

@ -1,66 +0,0 @@
#pragma once
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2022-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <maxscale/cdefs.h>
#include <maxbase/poll.h>
MXS_BEGIN_DECLS
typedef MXB_WORKER MXS_WORKER;
enum mxs_worker_msg_id
{
/**
* Shutdown message.
*
* arg1: 0
* arg2: NULL
*/
MXS_WORKER_MSG_SHUTDOWN,
/**
* Function call message.
*
* arg1: Pointer to function with the prototype: void (*)(MXS_WORKER*, void* arg2);
* arg2: Second argument for the function passed in arg1.
*/
MXS_WORKER_MSG_CALL
};
/**
* Return the current worker.
*
* @return A worker, or NULL if there is no current worker.
*/
MXS_WORKER* mxs_worker_get_current();
/**
* Post a message to a worker.
*
* @param worker The worker to whom the message should be sent.
* @param msg_id The message id.
* @param arg1 Message specific first argument.
* @param arg2 Message specific second argument.
*
* @return True if the message could be sent, false otherwise. If the message
* posting fails, errno is set appropriately.
*
* @attention The return value tells *only* whether the message could be sent,
* *not* that it has reached the worker.
*
* @attention This function is signal safe.
*/
bool mxs_worker_post_message(MXS_WORKER* worker, uint32_t msg_id, intptr_t arg1, intptr_t arg2);
MXS_END_DECLS

View File

@ -23,9 +23,9 @@
#include <maxbase/atomic.h>
#include <maxbase/semaphore.hh>
#include <maxbase/worker.h>
#include <maxscale/debug.h>
#include <maxscale/messagequeue.hh>
#include <maxscale/worker.h>
#include <maxscale/workertask.hh>
namespace maxscale
@ -483,7 +483,7 @@ private:
* associated with file descriptors. Internally Worker has a thread
* and an epoll-instance of its own.
*/
class Worker : public MXS_WORKER
class Worker : public MXB_WORKER
, private MessageQueue::Handler
{
Worker(const Worker&) = delete;