diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-11 15:39:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-11 15:39:23 -0700 |
commit | b78be5bd08436d5051cab96205328cd2aae21788 (patch) | |
tree | 3a9c1d9849a13d026d4f565d028ae6fb0f499401 | |
parent | 7652904f79f6e434568e0b8e5946cfcafc9aa767 (diff) | |
download | rneovim-b78be5bd08436d5051cab96205328cd2aae21788.tar.gz rneovim-b78be5bd08436d5051cab96205328cd2aae21788.tar.bz2 rneovim-b78be5bd08436d5051cab96205328cd2aae21788.zip |
rename: SplitEvent => MulticastEvent #10989
"Multicast" is perhaps a more conventional name for the concept.
"One-shot" is the conventional name for how the event is (currently)
scheduled.
-rw-r--r-- | src/nvim/event/multiqueue.c | 22 | ||||
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 3 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index a1b75f66a5..c9aa3acc4d 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -82,7 +82,7 @@ typedef struct { Event event; bool fired; int refcount; -} SplitEvent; +} MulticastEvent; ///< Event present on multiple queues. #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -253,25 +253,25 @@ static MultiQueueItem *multiqueue_node_data(QUEUE *q) return QUEUE_DATA(q, MultiQueueItem, node); } -/// Allow an event to be processed by multiple child queues to the main queue +/// Multicasts a one-shot event to multiple queues. /// -/// The handler will be fired once by the _first_ queue that processes the +/// The handler will be invoked once by the _first_ queue that consumes the /// event. Later processing will do nothing (just memory cleanup). /// -/// @param ev the event -/// @param num number of queues that the split event will be put on -/// @return an Event that is safe to put onto `num` queues -Event event_split(Event ev, int num) +/// @param ev Event +/// @param num Number of queues that the event will be put on +/// @return Event that is safe to put onto `num` queues +Event event_create_oneshot(Event ev, int num) { - SplitEvent *data = xmalloc(sizeof(*data)); + MulticastEvent *data = xmalloc(sizeof(*data)); data->event = ev; data->fired = false; data->refcount = num; - return event_create(split_event, 1, data); + return event_create(multiqueue_oneshot_event, 1, data); } -static void split_event(void ** argv) +static void multiqueue_oneshot_event(void **argv) { - SplitEvent *data = argv[0]; + MulticastEvent *data = argv[0]; if (!data->fired) { data->fired = true; if (data->event.handler) { diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 19f626c63b..0c874d7922 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -358,7 +358,8 @@ static void handle_request(Channel *channel, msgpack_object *request) } else { bool is_resize = handler.fn == handle_nvim_ui_try_resize; if (is_resize) { - Event ev = event_split(event_create(request_event, 1, evdata), 2); + Event ev = event_create_oneshot(event_create(request_event, 1, evdata), + 2); multiqueue_put_event(channel->events, ev); multiqueue_put_event(resize_events, ev); } else { |