diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-02-07 21:47:54 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-02-07 21:47:54 +0000 |
commit | 888927ac1c34c9b49f6f2b1808851c8eefe8fdda (patch) | |
tree | 5c31bcc2a016b95e050fc7e3ee1dc2a4d2e3db35 /package/libtapi/src/events.c | |
parent | 1adec35e142e8d51fda20fb8fa5c44337389201f (diff) |
[voip]
* drop libtapi and tapi_sip (moved to external git)
* add build variants to pjsip
* split tapi_dev audio driver out of patch into src/
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25412 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/libtapi/src/events.c')
-rw-r--r-- | package/libtapi/src/events.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/package/libtapi/src/events.c b/package/libtapi/src/events.c deleted file mode 100644 index 36e9b62a0..000000000 --- a/package/libtapi/src/events.c +++ /dev/null @@ -1,58 +0,0 @@ -#include <stdbool.h> -#include <sys/epoll.h> -#include <stdlib.h> -#include <errno.h> - -#include <stdio.h> - -#include "events.h" - -struct event_callback *event_callbacks; - -static int event_epoll_fd = -1; - -int event_register(int fd, int events, struct event_callback *cb) -{ - struct epoll_event ev; - - if (event_epoll_fd == -1) - event_epoll_fd = epoll_create(1); - - ev.events = events; - ev.data.ptr = cb; - - cb->fd = fd; - - return epoll_ctl(event_epoll_fd, EPOLL_CTL_ADD, fd, &ev); -} - -int event_unregister(int fd) -{ - return epoll_ctl(event_epoll_fd, EPOLL_CTL_DEL, fd, NULL); -} - -int tapi_mainloop(void) -{ - struct epoll_event ev[10]; - struct event_callback *cb; - int ret; - bool keep; - int i; - - if (event_epoll_fd == -1) - event_epoll_fd = epoll_create(1); - - while(true) { - ret = epoll_wait(event_epoll_fd, ev, 10, -1); - for(i = 0; i < ret; ++i) { - cb = ev[i].data.ptr; - keep = cb->callback(ev[i].events, cb->data); - if (!keep) - event_unregister(cb->fd); - } - if (ret < 0) - printf("epoll: %d\n", errno); - } - - return 0; -} |