mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
parent
7652904f79
commit
b78be5bd08
@ -82,7 +82,7 @@ typedef struct {
|
|||||||
Event event;
|
Event event;
|
||||||
bool fired;
|
bool fired;
|
||||||
int refcount;
|
int refcount;
|
||||||
} SplitEvent;
|
} MulticastEvent; ///< Event present on multiple queues.
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
@ -253,25 +253,25 @@ static MultiQueueItem *multiqueue_node_data(QUEUE *q)
|
|||||||
return QUEUE_DATA(q, MultiQueueItem, node);
|
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).
|
/// event. Later processing will do nothing (just memory cleanup).
|
||||||
///
|
///
|
||||||
/// @param ev the event
|
/// @param ev Event
|
||||||
/// @param num number of queues that the split event will be put on
|
/// @param num Number of queues that the event will be put on
|
||||||
/// @return an Event that is safe to put onto `num` queues
|
/// @return Event that is safe to put onto `num` queues
|
||||||
Event event_split(Event ev, int num)
|
Event event_create_oneshot(Event ev, int num)
|
||||||
{
|
{
|
||||||
SplitEvent *data = xmalloc(sizeof(*data));
|
MulticastEvent *data = xmalloc(sizeof(*data));
|
||||||
data->event = ev;
|
data->event = ev;
|
||||||
data->fired = false;
|
data->fired = false;
|
||||||
data->refcount = num;
|
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) {
|
if (!data->fired) {
|
||||||
data->fired = true;
|
data->fired = true;
|
||||||
if (data->event.handler) {
|
if (data->event.handler) {
|
||||||
|
@ -358,7 +358,8 @@ static void handle_request(Channel *channel, msgpack_object *request)
|
|||||||
} else {
|
} else {
|
||||||
bool is_resize = handler.fn == handle_nvim_ui_try_resize;
|
bool is_resize = handler.fn == handle_nvim_ui_try_resize;
|
||||||
if (is_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(channel->events, ev);
|
||||||
multiqueue_put_event(resize_events, ev);
|
multiqueue_put_event(resize_events, ev);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user