Add debug assertions into the core
The assertions make sure DCB writes and reads are only done by the thread that owns them.
This commit is contained in:
parent
f41ce6db16
commit
ba79028a46
@ -565,6 +565,7 @@ int dcb_read(DCB* dcb,
|
||||
GWBUF** head,
|
||||
int maxbytes)
|
||||
{
|
||||
mxb_assert(dcb->poll.owner == RoutingWorker::get_current());
|
||||
int nsingleread = 0;
|
||||
int nreadtotal = 0;
|
||||
|
||||
@ -904,6 +905,7 @@ static int dcb_log_errors_SSL(DCB* dcb, int ret)
|
||||
*/
|
||||
int dcb_write(DCB* dcb, GWBUF* queue)
|
||||
{
|
||||
mxb_assert(dcb->poll.owner == RoutingWorker::get_current());
|
||||
dcb->writeqlen += gwbuf_length(queue);
|
||||
// The following guarantees that queue is not NULL
|
||||
if (!dcb_write_parameter_check(dcb, queue))
|
||||
@ -3301,6 +3303,7 @@ public:
|
||||
RoutingWorker& rworker = static_cast<RoutingWorker&>(worker);
|
||||
if (dcb_is_still_valid(m_dcb, rworker.id()) && m_dcb->m_uid == m_uid)
|
||||
{
|
||||
mxb_assert(m_dcb->poll.owner == RoutingWorker::get_current());
|
||||
m_dcb->fakeq = m_buffer;
|
||||
dcb_handler(m_dcb, m_ev);
|
||||
}
|
||||
@ -3321,6 +3324,7 @@ static void poll_add_event_to_dcb(DCB* dcb, GWBUF* buf, uint32_t ev)
|
||||
{
|
||||
if (dcb == this_thread.current_dcb)
|
||||
{
|
||||
mxb_assert(dcb->poll.owner == RoutingWorker::get_current());
|
||||
// If the fake event is added to the current DCB, we arrange for
|
||||
// it to be handled immediately in dcb_handler() when the handling
|
||||
// of the current events are done...
|
||||
|
Loading…
x
Reference in New Issue
Block a user