#include<event2/event.h>voidread_cb(evutil_socket_t,short,void*);voidwrite_cb(evutil_socket_t,short,void*);voidmain_loop(evutil_socket_t fd){structevent*important,*unimportant;structevent_base*base; base =event_base_new();event_base_priority_init(base,2); /* Now base has priority 0, and priority 1 */ important =event_new(base, fd, EV_WRITE|EV_PERSIST, write_cb,NULL); unimportant =event_new(base, fd, EV_READ|EV_PERSIST, read_cb,NULL);event_priority_set(important,0);event_priority_set(unimportant,1); /* Now, whenever the fd is ready for writing, the write callback will happen before the read callback. The read callback won't happen at all until the write callback is no longer active. */}