Sorting out rebase
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum mxs_poll_action
|
||||
{
|
||||
MXS_POLL_NOP = 0x00,
|
||||
@ -96,3 +98,5 @@ int poll_add_fd_to_worker(int wid, int fd, uint32_t events, MXS_POLL_DATA* data)
|
||||
* @return 0 on success, non-zero on failure.
|
||||
*/
|
||||
int poll_remove_fd_from_worker(int wid, int fd);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -1,4 +1,3 @@
|
||||
<<<<<<< 11c7812d5d69c4fadef32cae5b7c121f2f596e38
|
||||
add_library(maxscale-common SHARED
|
||||
adminusers.cc
|
||||
alloc.cc
|
||||
|
@ -139,9 +139,9 @@ void dcb_global_init()
|
||||
|
||||
if ((zombies = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
|
||||
(all_dcbs = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
|
||||
(all_dcbs_lock = (SPINLOCK**)MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL ||
|
||||
(all_dcbs_lock = (SPINLOCK*)MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL ||
|
||||
(nzombies = (int*)MXS_CALLOC(nthreads, sizeof(int))) == NULL ||
|
||||
(fake_events = (fake_event_t*)MXS_CALLOC(nthreads, sizeof(fake_event_t*))) == NULL ||
|
||||
(fake_events = (fake_event_t**)MXS_CALLOC(nthreads, sizeof(fake_event_t*))) == NULL ||
|
||||
(fake_event_lock = (SPINLOCK*)MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL)
|
||||
{
|
||||
MXS_OOM();
|
||||
@ -3447,7 +3447,7 @@ static void poll_add_event_to_dcb(DCB* dcb,
|
||||
GWBUF* buf,
|
||||
uint32_t ev)
|
||||
{
|
||||
fake_event_t *event = MXS_MALLOC(sizeof(*event));
|
||||
fake_event_t *event = (fake_event_t*)MXS_MALLOC(sizeof(*event));
|
||||
|
||||
if (event)
|
||||
{
|
||||
|
@ -1307,75 +1307,6 @@ poll_loadav(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< 6b2042c75fd64c7a8d0fa2fca4c68d02dd0c8a62:server/core/poll.cc
|
||||
void poll_add_epollin_event_to_dcb(DCB* dcb,
|
||||
GWBUF* buf)
|
||||
{
|
||||
__uint32_t ev;
|
||||
|
||||
ev = EPOLLIN;
|
||||
|
||||
poll_add_event_to_dcb(dcb, buf, ev);
|
||||
}
|
||||
|
||||
|
||||
static void poll_add_event_to_dcb(DCB* dcb,
|
||||
GWBUF* buf,
|
||||
uint32_t ev)
|
||||
{
|
||||
fake_event_t *event = (fake_event_t*)MXS_MALLOC(sizeof(*event));
|
||||
|
||||
if (event)
|
||||
{
|
||||
event->data = buf;
|
||||
event->dcb = dcb;
|
||||
event->event = ev;
|
||||
event->next = NULL;
|
||||
event->tail = event;
|
||||
|
||||
int thr = dcb->poll.thread.id;
|
||||
|
||||
/** It is possible that a housekeeper or a monitor thread inserts a fake
|
||||
* event into the thread's event queue which is why the operation needs
|
||||
* to be protected by a spinlock */
|
||||
spinlock_acquire(&fake_event_lock[thr]);
|
||||
|
||||
if (fake_events[thr])
|
||||
{
|
||||
fake_events[thr]->tail->next = event;
|
||||
fake_events[thr]->tail = event;
|
||||
}
|
||||
else
|
||||
{
|
||||
fake_events[thr] = event;
|
||||
}
|
||||
|
||||
spinlock_release(&fake_event_lock[thr]);
|
||||
}
|
||||
}
|
||||
|
||||
void poll_fake_write_event(DCB *dcb)
|
||||
{
|
||||
poll_add_event_to_dcb(dcb, NULL, EPOLLOUT);
|
||||
}
|
||||
|
||||
void poll_fake_read_event(DCB *dcb)
|
||||
{
|
||||
poll_add_event_to_dcb(dcb, NULL, EPOLLIN);
|
||||
}
|
||||
|
||||
void poll_fake_hangup_event(DCB *dcb)
|
||||
{
|
||||
#ifdef EPOLLRDHUP
|
||||
uint32_t ev = EPOLLRDHUP;
|
||||
#else
|
||||
uint32_t ev = EPOLLHUP;
|
||||
#endif
|
||||
poll_add_event_to_dcb(dcb, NULL, ev);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> Move DCB specific event handling to dcb.c:server/core/poll.c
|
||||
/**
|
||||
* Print the event queue statistics
|
||||
*
|
||||
|
Reference in New Issue
Block a user