epoll: Implement iv_event offloads using an always-active file descriptor.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_event_raw_test: Add missing nanosecond wrap check on timeout calculation.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Rename struct iv_wait's 'events' member to 'events_pending'.

To work around a braindead and broken '#define events reqevents' in
AIX7's version of sys/poll.h.

This changes the name of a member of a public struct, but this
doesn't change the structure length or layout, and the member is a
private member, so this does not constitute an ABI or API break.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Increase failure timeout on test/timer_order.

On an old Tru64 box this test takes about 40 seconds, so let's bump
the timeout to two minutes.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Introduce const correctness.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_fd_poll: Stop using fd->registered_bands.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_timer: Embed the lowest radix tree leaf node into struct iv_state.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Get rid of __thread (per-thread) ivykis state pointer.

Since there is pretty much no measurable performance difference even in
contrived scenarios on some of the more sane platforms ivykis supports,
get rid of the per-thread ivykis state pointer, and unconditionally use
the pthread_getspecific() method to access the state pointer on all
platforms.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Remove __sync_lock_test_and_set() based spinlock implementation.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Remove various unnecessary inclusions of config.h, and move some around.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Move iv_event_run_pending_events() prototype to iv_private.h.

Since it is technically not POSIX-specific, even if it's only used
on POSIX platforms right now.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_fd_epoll: Convert to make use of mutex.h.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_wait: Convert to make use of mutex.h.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_signal: Stop relying on being able to clear the signal tree post-fork.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Link-time conditionalize the use of the pthread_setspecific() API.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_event: Optimize away creation of iv_event_raw in single-threaded apps.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_signal: Link-time conditionalize the use of pthreads APIs.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_thread_posix: Link-time conditionalize the use of pthreads APIs.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
mutex.h: Link-time conditionalize the use of pthreads APIs.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
spinlock.h: Link-time conditionalize the use of pthreads APIs.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>