summaryrefslogtreecommitdiff
path: root/sysdep/unix/io-loop.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/unix/io-loop.h')
-rw-r--r--sysdep/unix/io-loop.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/sysdep/unix/io-loop.h b/sysdep/unix/io-loop.h
index e23a9be0..e606f07e 100644
--- a/sysdep/unix/io-loop.h
+++ b/sysdep/unix/io-loop.h
@@ -16,8 +16,15 @@ struct pipe
int fd[2];
};
+struct pfd {
+ BUFFER(struct pollfd) pfd;
+ BUFFER(struct birdloop *) loop;
+};
+
+void sockets_prepare(struct birdloop *, struct pfd *);
+
void pipe_new(struct pipe *);
-void pipe_pollin(struct pipe *, struct pollfd *);
+void pipe_pollin(struct pipe *, struct pfd *);
void pipe_drain(struct pipe *);
void pipe_kick(struct pipe *);
@@ -25,6 +32,9 @@ struct birdloop
{
node n;
+ event event;
+ timer timer;
+
pool *pool;
struct timeloop time;
@@ -36,6 +46,9 @@ struct birdloop
uint links;
+ _Atomic u32 thread_transition;
+#define LTT_PING 1
+#define LTT_MOVE 2
_Atomic u32 flags;
struct birdloop_flag_handler *flag_handler;
@@ -45,7 +58,6 @@ struct birdloop
struct birdloop *prev_loop;
struct bird_thread *thread;
- struct pollfd *pfd;
u64 total_time_spent_ns;
};
@@ -54,16 +66,13 @@ struct bird_thread
{
node n;
- struct pollfd *pfd;
- uint pfd_max;
-
- _Atomic u32 ping_sent;
- _Atomic u32 run_cleanup;
_Atomic u32 poll_changed;
struct pipe wakeup;
event_list priority_events;
+ struct birdloop *meta;
+
pthread_t thread_id;
pthread_attr_t thread_attr;
@@ -71,6 +80,7 @@ struct bird_thread
list loops;
pool *pool;
+ struct pfd *pfd;
event cleanup_event;
};