Skip to content

Instantly share code, notes, and snippets.

@azat
Created April 4, 2020 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azat/de3570933a86732e06add8620604aa2c to your computer and use it in GitHub Desktop.
Save azat/de3570933a86732e06add8620604aa2c to your computer and use it in GitHub Desktop.
// https://github.com/libevent/libevent/issues/984
#include <event2/event.h>
#include <assert.h>
void readcb(int fd, short events, void *arg)
{
printf("%s: fd=%i, events=%hi\n", __func__);
}
void closecb(int fd, short events, void *arg)
{
printf("%s: fd=%i, events=%hi\n", __func__);
}
int main()
{
struct event_base *base = event_base_new();
//struct event *ev1 = event_new(base, 0, EV_READ, readcb, NULL);
struct event *ev2 = event_new(base, 0, EV_CLOSED|EV_ET, closecb, NULL);
//assert(!event_add(ev1, NULL));
assert(!event_add(ev2, NULL));
return event_base_dispatch(base);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment