Remove atomic operations from buffers
As buffers are meant to be used only within a particular session, the atomic operations are no longer necessary and can thus be removed. This removes the extra overhead that the atomic operations add.
This commit is contained in:
@ -18,7 +18,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <maxbase/assert.h>
|
#include <maxbase/assert.h>
|
||||||
#include <maxbase/atomic.hh>
|
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
#include <maxscale/hint.h>
|
#include <maxscale/hint.h>
|
||||||
#include <maxscale/log.h>
|
#include <maxscale/log.h>
|
||||||
@ -118,7 +117,9 @@ void gwbuf_free(GWBUF* buf)
|
|||||||
*/
|
*/
|
||||||
static void gwbuf_free_one(GWBUF* buf)
|
static void gwbuf_free_one(GWBUF* buf)
|
||||||
{
|
{
|
||||||
if (mxb::atomic::add(&buf->sbuf->refcount, -1) == 1)
|
--buf->sbuf->refcount;
|
||||||
|
|
||||||
|
if (buf->sbuf->refcount == 0)
|
||||||
{
|
{
|
||||||
buffer_object_t* bo = buf->sbuf->bufobj;
|
buffer_object_t* bo = buf->sbuf->bufobj;
|
||||||
|
|
||||||
@ -169,7 +170,7 @@ static GWBUF* gwbuf_clone_one(GWBUF* buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mxb_assert(buf->owner == RoutingWorker::get_current_id());
|
mxb_assert(buf->owner == RoutingWorker::get_current_id());
|
||||||
mxb::atomic::add(&buf->sbuf->refcount, 1);
|
++buf->sbuf->refcount;
|
||||||
#ifdef SS_DEBUG
|
#ifdef SS_DEBUG
|
||||||
rval->owner = RoutingWorker::get_current_id();
|
rval->owner = RoutingWorker::get_current_id();
|
||||||
#endif
|
#endif
|
||||||
@ -256,7 +257,7 @@ static GWBUF* gwbuf_clone_portion(GWBUF* buf,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mxb::atomic::add(&buf->sbuf->refcount, 1);
|
++buf->sbuf->refcount;
|
||||||
#ifdef SS_DEBUG
|
#ifdef SS_DEBUG
|
||||||
clonebuf->owner = RoutingWorker::get_current_id();
|
clonebuf->owner = RoutingWorker::get_current_id();
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user