MXS-1392 Remove remnats of DCB reference counting
This commit is contained in:
@ -122,12 +122,6 @@ static uint32_t dcb_poll_handler(MXS_POLL_DATA *data, int thread_id, uint32_t ev
|
||||
static uint32_t dcb_process_poll_events(DCB *dcb, uint32_t ev);
|
||||
static bool dcb_session_check(DCB *dcb, const char *);
|
||||
|
||||
static void poll_dcb_free(MXS_POLL_DATA* data)
|
||||
{
|
||||
// MXS_POLL_DATA is the first member of DCB.
|
||||
dcb_free_all_memory(reinterpret_cast<DCB*>(data));
|
||||
}
|
||||
|
||||
void dcb_global_init()
|
||||
{
|
||||
this_unit.dcb_initialized.dcb_chk_top = CHK_NUM_DCB;
|
||||
@ -135,8 +129,6 @@ void dcb_global_init()
|
||||
this_unit.dcb_initialized.state = DCB_STATE_ALLOC;
|
||||
this_unit.dcb_initialized.ssl_state = SSL_HANDSHAKE_UNKNOWN;
|
||||
this_unit.dcb_initialized.poll.handler = dcb_poll_handler;
|
||||
this_unit.dcb_initialized.poll.free = poll_dcb_free;
|
||||
this_unit.dcb_initialized.poll.refcount = 1;
|
||||
this_unit.dcb_initialized.dcb_chk_tail = CHK_NUM_DCB;
|
||||
|
||||
int nthreads = config_threadcount();
|
||||
|
||||
@ -19,58 +19,4 @@ MXS_BEGIN_DECLS
|
||||
void dcb_free_all_memory(DCB *dcb);
|
||||
void dcb_final_close(DCB *dcb);
|
||||
|
||||
/**
|
||||
* @brief Increase the reference count of the DCB
|
||||
*
|
||||
* @param dcb The dcb whose reference count should be increased.
|
||||
*/
|
||||
static inline void dcb_inc_ref(DCB* dcb)
|
||||
{
|
||||
// A DCB starts out with a refcount of 1.
|
||||
ss_dassert(dcb->poll.refcount >= 1);
|
||||
|
||||
poll_inc_ref(&dcb->poll);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decrease the reference count of the DCB. If it reaches 0,
|
||||
* the DCB will be freed.
|
||||
*
|
||||
* @param dcb The dcb whose reference count should be decreased.
|
||||
*
|
||||
* @return True, if the dcb is still usable after the call, otherwise false.
|
||||
*
|
||||
* @note If the function returns false, the caller cannot use the dcb
|
||||
* for anything.
|
||||
*/
|
||||
static inline bool dcb_dec_ref(DCB* dcb)
|
||||
{
|
||||
// A DCB starts out with a refcount of 1.
|
||||
ss_dassert(dcb->poll.refcount >= 1);
|
||||
|
||||
bool rv = true;
|
||||
if (poll_dec_ref(&dcb->poll) == 1)
|
||||
{
|
||||
dcb_free_all_memory(dcb);
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Increase the reference count of the DCB.
|
||||
*
|
||||
* Convenience function for the situation where a received dcb is stored
|
||||
* and the reference count needs to be increased.
|
||||
*
|
||||
* @param dcb The dcb whose reference count should be increased.
|
||||
*
|
||||
* @return The dcb provided as argument.
|
||||
*/
|
||||
static inline DCB* dcb_get_ref(DCB* dcb)
|
||||
{
|
||||
dcb_inc_ref(dcb);
|
||||
return dcb;
|
||||
}
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
@ -163,8 +163,6 @@ Worker::Worker(int id,
|
||||
, m_shutdown_initiated(false)
|
||||
{
|
||||
MXS_POLL_DATA::handler = &Worker::epoll_instance_handler;
|
||||
MXS_POLL_DATA::free = NULL;
|
||||
MXS_POLL_DATA::refcount = 0;
|
||||
MXS_POLL_DATA::thread.id = id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user