Switch to an epoll-based reactor implementation.
epoll is a much nicer interface that very closely matches the
reactor interface. It's also thread-safe which makes it a more
suitable choice for bluedroid. As a result of this change,
reactor_register and reactor_unregister are both thread-safe without
introducing any synchronization in user-space.
diff --git a/osi/include/socket.h b/osi/include/socket.h
index e9ec824..754e468 100644
--- a/osi/include/socket.h
+++ b/osi/include/socket.h
@@ -21,8 +21,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "thread.h"
-
typedef struct reactor_t reactor_t;
typedef struct socket_t socket_t;
typedef uint16_t port_t;
@@ -68,13 +66,13 @@
// may be NULL.
ssize_t socket_write(const socket_t *socket, const void *buf, size_t count);
-// Registers |socket| with the |thread|. When the socket becomes readable, |read_cb|
+// Registers |socket| with the |reactor|. When the socket becomes readable, |read_cb|
// will be called. When the socket becomes writeable, |write_cb| will be called. The
// |context| parameter is passed, untouched, to each of the callback routines. Neither
-// |socket| nor |thread| may be NULL. |read_cb| or |write_cb|, but not both, may be NULL.
+// |socket| nor |reactor| may be NULL. |read_cb| or |write_cb|, but not both, may be NULL.
// |context| may be NULL.
-void socket_register(socket_t *socket, thread_t *thread, socket_cb read_cb, socket_cb write_cb, void *context);
+void socket_register(socket_t *socket, reactor_t *reactor, void *context, socket_cb read_cb, socket_cb write_cb);
-// Unregisters |socket| from whichever thread it is registered with, if any. This
+// Unregisters |socket| from whichever reactor it is registered with, if any. This
// function is idempotent.
void socket_unregister(socket_t *socket);