summaryrefslogtreecommitdiff
path: root/lib/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread.h')
-rw-r--r--lib/thread.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/thread.h b/lib/thread.h
index ec774a6543..7897265120 100644
--- a/lib/thread.h
+++ b/lib/thread.h
@@ -26,6 +26,7 @@
#include <poll.h>
#include "monotime.h"
#include "frratomic.h"
+#include "typesafe.h"
#ifdef __cplusplus
extern "C" {
@@ -39,12 +40,7 @@ struct rusage_t {
#define GETRUSAGE(X) thread_getrusage(X)
-/* Linked list of thread. */
-struct thread_list {
- struct thread *head;
- struct thread *tail;
- int count;
-};
+PREDECL_LIST(thread_list)
struct pqueue;
@@ -78,9 +74,7 @@ struct thread_master {
struct thread **read;
struct thread **write;
struct pqueue *timer;
- struct thread_list event;
- struct thread_list ready;
- struct thread_list unuse;
+ struct thread_list_head event, ready, unuse;
struct list *cancel_req;
bool canceled;
pthread_cond_t cancel_cond;
@@ -100,8 +94,7 @@ struct thread_master {
struct thread {
uint8_t type; /* thread type */
uint8_t add_type; /* thread type */
- struct thread *next; /* next pointer of the thread */
- struct thread *prev; /* previous pointer of the thread */
+ struct thread_list_item threaditem;
struct thread **ref; /* external reference (if given) */
struct thread_master *master; /* pointer to the struct thread_master */
int (*func)(struct thread *); /* event function */