你能在 libuv 中确定事件的优先级吗?

Can you prioritize events in libuv?

假设我有 2 个正在监视事件的套接字,我真的希望套接字 1 优先(事件的代价是使套接字 2 挨饿)。我将如何使用 libuv 做到这一点?

作为使用 libevent 的示例,可以使用:

int event_priority_set(struct event *event, int priority);

When multiple events of multiple priorities become active, the low-priority events are not run. Instead, Libevent runs the high priority events, then checks for events again. Only when no high-priority events are active are the low-priority events run.

在 libuv 中无法做到这一点。在 libuv 中没有事件的抽象(所以没有 struct event 或一些等效的东西),所有 i/o 回调在它们发生时被调度。