diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-03-21 09:55:05 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-03-31 16:56:51 +0200 |
commit | 61f28880d5dc3f08689bef61a54fa2035928ffaa (patch) | |
tree | 04574f58327f38d26b2c9df0ab4f93c236477255 /include/osmocom | |
parent | fb348eeff25e8e66a4a8651dc94901c7a004343a (diff) |
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
Diffstat (limited to 'include/osmocom')
-rw-r--r-- | include/osmocom/core/select.h | 6 |
1 files changed, 6 insertions, 0 deletions
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); + /*! @} */ |