Created
November 14, 2016 21:56
-
-
Save azat/d76de36a8980b888e111a267666b1794 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
libevent | |
user-triggered event example | |
*/ | |
#include <event2/event.h> | |
void cb(int fd, short events, void *arg) | |
{ | |
puts("cb"); | |
} | |
int main() | |
{ | |
struct event_base *base = event_base_new(); | |
struct event *event = event_new(base, -1, EV_READ, cb, NULL); | |
event_active(event, 0, 0); | |
puts("start event loop"); | |
event_base_loop(base, 0); | |
puts("exit event loop"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.