diff options
author | Maria Matejka <mq@ucw.cz> | 2022-07-28 19:22:48 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-07-28 19:22:48 +0200 |
commit | 03bf6b90879bb6e5f0fab05a61a843bb437dd30a (patch) | |
tree | 2eb0cff73002b4278916c1ad6865b7a85b680bd1 /lib/event.c | |
parent | 6e841b3153565632b6753f6b1fe74850c37f2808 (diff) |
Revert "Adding a generic cork mechanism for events"
This reverts commit 6e841b3153565632b6753f6b1fe74850c37f2808.
Diffstat (limited to 'lib/event.c')
-rw-r--r-- | lib/event.c | 74 |
1 files changed, 6 insertions, 68 deletions
diff --git a/lib/event.c b/lib/event.c index 5031f314..6c5c8b14 100644 --- a/lib/event.c +++ b/lib/event.c @@ -114,42 +114,17 @@ ev_send(event_list *l, event *e) e->list = l; - struct event_cork *ec = e->cork; - - uint ping = 0; - - if (ec) + LOCK_DOMAIN(event, l->lock); + if (enlisted(&e->n)) { - LOCK_DOMAIN(cork, ec->lock); - LOCK_DOMAIN(event, l->lock); - - if (!enlisted(&e->n)) - if (ec->count) - add_tail(&ec->events, &e->n); - else - { - add_tail(&l->events, &e->n); - ping = 1; - } - UNLOCK_DOMAIN(event, l->lock); - UNLOCK_DOMAIN(cork, ec->lock); + return; } - else - { - LOCK_DOMAIN(event, l->lock); - if (!enlisted(&e->n)) - { - add_tail(&l->events, &e->n); - ping = 1; - } - - UNLOCK_DOMAIN(event, l->lock); - } + add_tail(&l->events, &e->n); + UNLOCK_DOMAIN(event, l->lock); - if (ping) - birdloop_ping(l->loop); + birdloop_ping(l->loop); } void io_log_event(void *hook, void *data); @@ -249,40 +224,3 @@ ev_run_list_limited(event_list *l, uint limit) return repeat; } - -void ev_cork(struct event_cork *ec) -{ - LOCK_DOMAIN(cork, ec->lock); - ec->count++; - UNLOCK_DOMAIN(cork, ec->lock); -} - -void ev_uncork(struct event_cork *ec) -{ - LOCK_DOMAIN(cork, ec->lock); - - if (--ec->count) - { - UNLOCK_DOMAIN(cork, ec->lock); - return; - } - - node *n; - WALK_LIST_FIRST(n, ec->events) - { - event *e = SKIP_BACK(event, n, n); - event_list *el = e->list; - - rem_node(&e->n); - - LOCK_DOMAIN(event, el->lock); - add_tail(&el->events, &e->n); - UNLOCK_DOMAIN(event, el->lock); - - birdloop_ping(el->loop); - } - - UNLOCK_DOMAIN(cork, ec->lock); - - birdloop_ping(&main_birdloop); -} |