From 61f28880d5dc3f08689bef61a54fa2035928ffaa Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 21 Mar 2016 09:55:05 +0100 Subject: select: Externalize fd_set filling and dispatch To integrate with an external event loop (in this case glib) we need to allow an application to get a filled out fd_set and then dispatch it. osmo_fds and maxfds are static and I decided to keep it that way and instead create two routines to fill the fdset and then one to dispatch the result. The public header file does not include sys/select.h and we can compile the library without select, so I didn't want to require having to include this file, and used void * for the parameter. Mark the routines as inline to avoid a call from the select function. I have confirmed that inlining has an effect on x86 using Debian's gcc-4.9.2-10 compiler --- include/osmocom/core/select.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/osmocom/core/select.h') diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h index b9e3b51a..2753637a 100644 --- a/include/osmocom/core/select.h +++ b/include/osmocom/core/select.h @@ -41,4 +41,10 @@ int osmo_select_main(int polling); struct osmo_fd *osmo_fd_get_by_fd(int fd); +/* + * foreign event loop integration + */ +int osmo_fd_fill_fds(void *readset, void *writeset, void *exceptset); +int osmo_fd_disp_fds(void *readset, void *writeset, void *exceptset); + /*! @} */ -- cgit v1.2.3