summaryrefslogtreecommitdiff
path: root/lib/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread.h')
-rw-r--r--lib/thread.h35
1 files changed, 8 insertions, 27 deletions
diff --git a/lib/thread.h b/lib/thread.h
index 7e79eb38dc..86f839810f 100644
--- a/lib/thread.h
+++ b/lib/thread.h
@@ -22,8 +22,9 @@
#define _ZEBRA_THREAD_H
#include <zebra.h>
-#include "monotime.h"
#include <pthread.h>
+#include <poll.h>
+#include "monotime.h"
struct rusage_t
{
@@ -44,14 +45,6 @@ struct thread_list
struct pqueue;
-/*
- * Abstract it so we can use different methodologies to
- * select on data.
- */
-typedef fd_set thread_fd_set;
-
-#if defined(HAVE_POLL_CALL)
-#include <poll.h>
struct fd_handler
{
/* number of pfd stored in pfds */
@@ -60,16 +53,11 @@ struct fd_handler
nfds_t pfdcountsnmp;
/* number of pfd that fit in the allocated space of pfds */
nfds_t pfdsize;
+ /* file descriptors to monitor for i/o */
struct pollfd *pfds;
+ /* chunk used for temp copy of pollfds */
+ struct pollfd *copy;
};
-#else
-struct fd_handler
-{
- fd_set readfd;
- fd_set writefd;
- fd_set exceptfd;
-};
-#endif
/* Master of the theads. */
struct thread_master
@@ -80,7 +68,7 @@ struct thread_master
struct thread_list event;
struct thread_list ready;
struct thread_list unuse;
- struct pqueue *background;
+ int io_pipe[2];
int fd_limit;
struct fd_handler handler;
unsigned long alloc;
@@ -142,9 +130,8 @@ struct cpu_thread_history
#define THREAD_TIMER 2
#define THREAD_EVENT 3
#define THREAD_READY 4
-#define THREAD_BACKGROUND 5
-#define THREAD_UNUSED 6
-#define THREAD_EXECUTE 7
+#define THREAD_UNUSED 5
+#define THREAD_EXECUTE 6
/* Thread yield time. */
#define THREAD_YIELD_TIME_SLOT 10 * 1000L /* 10ms */
@@ -177,9 +164,6 @@ struct cpu_thread_history
#define thread_add_event(m,f,a,v,t) funcname_thread_add_event(m,f,a,v,t,#f,__FILE__,__LINE__)
#define thread_execute(m,f,a,v) funcname_thread_execute(m,f,a,v,#f,__FILE__,__LINE__)
-/* The 4th arg to thread_add_background is the # of milliseconds to delay. */
-#define thread_add_background(m,f,a,v,t) funcname_thread_add_background(m,f,a,v,t,#f,__FILE__,__LINE__)
-
/* Prototypes. */
extern struct thread_master *thread_master_create (void);
extern void thread_master_free (struct thread_master *);
@@ -200,9 +184,6 @@ extern struct thread * funcname_thread_add_timer_tv (struct thread_master *,
extern struct thread * funcname_thread_add_event (struct thread_master *,
int (*)(struct thread *), void *, int, struct thread **, debugargdef);
-extern struct thread * funcname_thread_add_background (struct thread_master *,
- int (*)(struct thread *), void *, long, struct thread **, debugargdef);
-
extern void funcname_thread_execute (struct thread_master *,
int (*)(struct thread *), void *, int, debugargdef);
#undef debugargdef