kqueue instead of select if available
support for kqueue() works

on a small number of filedescriptors on OSX the improvement is not much noticeable
the epoll-based implementation now works properly

and timeouts are now also implemented via epoll