Socket_poll documentation -- overview

Intro

All functions are documented in functions.html, all constants are in constants.html and the namespace rules are in namespace.html (fancy that).

Basically you should be able to get an overview of a function by looking at the functions.html file, and be able to get a deeper understanding by looking in the constants.html file (Ie. all constants should be passed to a function listed, so the more detailed information is listed with the constants -- not the functions).

A very simple overview

A very simple overview is that you create a Socket_poll_typedef_offset by passing an fd to socket_poll_add(). You can then use it via. SOCKET_POLL_INDICATOR() as a normal (struct pollfd *) and by calling socket_poll_update_all(), instead of poll().

Also note that you might want to have a look at the examples/ directory ex1.c is the most simple usage, ex2.c is more complicated etc.

Why is this library different from calling poll() ?

There are two basic reasons why you might want to use this library instead of just calling poll(). Though do remember that this library is built on top of poll(), so when you use this library you are using poll() (or select when in emulation mode) just with a bunch more code to help you out.

The first reason is speed, this library is built to be able to work as well as possible with large numbers of file descriptors. In a normal poll() application you'll loop over your file descriptors 3 times (once to setup the poll() call, once after the poll() call and once in your main loop to act on the poll information), using this library it's easy to do the minimum of 1 loop. note that on Linux you can get another speedup by calling socket_poll_update_all() with an argument of zero and if that returns zero then calling it again with the real timeout.

The second reason is ease of use, you might not agree if you've written poll()'ing applications a lot. However in my opinion it is very easy to get an application running using this library, and it'll be portable ... even to those systems that only have select() (or ones that have a broken version of poll()).


James Antill
Last modified: Sun Aug 27 10:42:19 EDT 2000