summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/agentx.c12
-rw-r--r--lib/bfd.c4
-rw-r--r--lib/event.c134
-rw-r--r--lib/event.h62
-rw-r--r--lib/frr_pthread.c6
-rw-r--r--lib/frr_zmq.c4
-rw-r--r--lib/frr_zmq.h2
-rw-r--r--lib/grammar_sandbox_main.c6
-rw-r--r--lib/ldp_sync.h2
-rw-r--r--lib/libfrr.c8
-rw-r--r--lib/libfrr.h2
-rw-r--r--lib/libfrr_trace.h2
-rw-r--r--lib/log.c4
-rw-r--r--lib/mgmt_be_client.c20
-rw-r--r--lib/mgmt_fe_client.c20
-rw-r--r--lib/northbound_cli.c2
-rw-r--r--lib/northbound_confd.c8
-rw-r--r--lib/northbound_grpc.cpp10
-rw-r--r--lib/northbound_sysrepo.c4
-rw-r--r--lib/pullwr.c6
-rw-r--r--lib/resolver.c12
-rw-r--r--lib/resolver.h2
-rw-r--r--lib/sigevent.c4
-rw-r--r--lib/spf_backoff.c8
-rw-r--r--lib/systemd.c2
-rw-r--r--lib/vty.c16
-rw-r--r--lib/vty.h8
-rw-r--r--lib/wheel.c6
-rw-r--r--lib/wheel.h2
-rw-r--r--lib/workqueue.c2
-rw-r--r--lib/workqueue.h4
-rw-r--r--lib/yang.h2
-rw-r--r--lib/zclient.c6
-rw-r--r--lib/zclient.h6
-rw-r--r--lib/zlog.c2
-rw-r--r--lib/zlog_5424.c2
-rw-r--r--lib/zlog_5424.h4
37 files changed, 202 insertions, 204 deletions
diff --git a/lib/agentx.c b/lib/agentx.c
index 2f45ae833..a17ee1725 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -28,12 +28,12 @@ DEFINE_HOOK(agentx_enabled, (), ());
static bool agentx_enabled = false;
static struct thread_master *agentx_tm;
-static struct thread *timeout_thr = NULL;
+static struct event *timeout_thr = NULL;
static struct list *events = NULL;
static void agentx_events_update(void);
-static void agentx_timeout(struct thread *t)
+static void agentx_timeout(struct event *t)
{
snmp_timeout();
run_alarms();
@@ -41,13 +41,13 @@ static void agentx_timeout(struct thread *t)
agentx_events_update();
}
-static void agentx_read(struct thread *t)
+static void agentx_read(struct event *t)
{
fd_set fds;
int flags, new_flags = 0;
int nonblock = false;
struct listnode *ln = THREAD_ARG(t);
- struct thread **thr = listgetdata(ln);
+ struct event **thr = listgetdata(ln);
XFREE(MTYPE_TMP, thr);
list_delete_node(events, ln);
@@ -94,7 +94,7 @@ static void agentx_events_update(void)
struct timeval timeout = {.tv_sec = 0, .tv_usec = 0};
fd_set fds;
struct listnode *ln;
- struct thread **thr;
+ struct event **thr;
int fd, thr_fd;
thread_cancel(&timeout_thr);
@@ -130,8 +130,8 @@ static void agentx_events_update(void)
/* need listener, but haven't hit one where it would be */
else if (FD_ISSET(fd, &fds)) {
struct listnode *newln;
- thr = XCALLOC(MTYPE_TMP, sizeof(struct thread *));
+ thr = XCALLOC(MTYPE_TMP, sizeof(struct event *));
newln = listnode_add_before(events, ln, thr);
thread_add_read(agentx_tm, agentx_read, newln, fd, thr);
}
diff --git a/lib/bfd.c b/lib/bfd.c
index c430b1d7e..04f1c27b8 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -87,7 +87,7 @@ struct bfd_session_params {
* configuration load or northbound batch), so we'll use this to
* install/uninstall the BFD session parameters only once.
*/
- struct thread *installev;
+ struct event *installev;
/** BFD session installation state. */
bool installed;
@@ -485,7 +485,7 @@ static bool _bfd_sess_valid(const struct bfd_session_params *bsp)
return true;
}
-static void _bfd_sess_send(struct thread *t)
+static void _bfd_sess_send(struct event *t)
{
struct bfd_session_params *bsp = THREAD_ARG(t);
int rv;
diff --git a/lib/event.c b/lib/event.c
index b0f901ab0..266670e39 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -28,19 +28,19 @@ DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master");
DEFINE_MTYPE_STATIC(LIB, THREAD_POLL, "Thread Poll Info");
DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats");
-DECLARE_LIST(thread_list, struct thread, threaditem);
+DECLARE_LIST(thread_list, struct event, threaditem);
struct cancel_req {
int flags;
- struct thread *thread;
+ struct event *thread;
void *eventobj;
- struct thread **threadref;
+ struct event **threadref;
};
/* Flags for task cancellation */
#define THREAD_CANCEL_FLAG_READY 0x01
-static int thread_timer_cmp(const struct thread *a, const struct thread *b)
+static int thread_timer_cmp(const struct event *a, const struct event *b)
{
if (a->u.sands.tv_sec < b->u.sands.tv_sec)
return -1;
@@ -53,7 +53,7 @@ static int thread_timer_cmp(const struct thread *a, const struct thread *b)
return 0;
}
-DECLARE_HEAP(thread_timer_list, struct thread, timeritem, thread_timer_cmp);
+DECLARE_HEAP(thread_timer_list, struct event, timeritem, thread_timer_cmp);
#if defined(__APPLE__)
#include <mach/mach.h>
@@ -73,7 +73,7 @@ pthread_key_t thread_current;
static pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER;
static struct list *masters;
-static void thread_free(struct thread_master *master, struct thread *thread);
+static void thread_free(struct thread_master *master, struct event *thread);
#ifndef EXCLUDE_CPU_TIME
#define EXCLUDE_CPU_TIME 0
@@ -399,7 +399,7 @@ static void show_thread_poll_helper(struct vty *vty, struct thread_master *m)
{
const char *name = m->name ? m->name : "main";
char underline[strlen(name) + 1];
- struct thread *thread;
+ struct event *thread;
uint32_t i;
memset(underline, '-', sizeof(underline));
@@ -485,7 +485,7 @@ static void show_thread_timers_helper(struct vty *vty, struct thread_master *m)
{
const char *name = m->name ? m->name : "main";
char underline[strlen(name) + 1];
- struct thread *thread;
+ struct event *thread;
memset(underline, '-', sizeof(underline));
underline[sizeof(underline) - 1] = '\0';
@@ -571,10 +571,10 @@ struct thread_master *thread_master_create(const char *name)
}
rv->read = XCALLOC(MTYPE_THREAD_POLL,
- sizeof(struct thread *) * rv->fd_limit);
+ sizeof(struct event *) * rv->fd_limit);
rv->write = XCALLOC(MTYPE_THREAD_POLL,
- sizeof(struct thread *) * rv->fd_limit);
+ sizeof(struct event *) * rv->fd_limit);
char tmhashname[strlen(name) + 32];
snprintf(tmhashname, sizeof(tmhashname), "%s - threadmaster event hash",
@@ -634,14 +634,14 @@ void thread_master_set_name(struct thread_master *master, const char *name)
#define THREAD_UNUSED_DEPTH 10
/* Move thread to unuse list. */
-static void thread_add_unuse(struct thread_master *m, struct thread *thread)
+static void thread_add_unuse(struct thread_master *m, struct event *thread)
{
pthread_mutex_t mtxc = thread->mtx;
assert(m != NULL && thread != NULL);
thread->hist->total_active--;
- memset(thread, 0, sizeof(struct thread));
+ memset(thread, 0, sizeof(struct event));
thread->type = THREAD_UNUSED;
/* Restore the thread mutex context. */
@@ -659,16 +659,16 @@ static void thread_add_unuse(struct thread_master *m, struct thread *thread)
static void thread_list_free(struct thread_master *m,
struct thread_list_head *list)
{
- struct thread *t;
+ struct event *t;
while ((t = thread_list_pop(list)))
thread_free(m, t);
}
static void thread_array_free(struct thread_master *m,
- struct thread **thread_array)
+ struct event **thread_array)
{
- struct thread *t;
+ struct event *t;
int index;
for (index = 0; index < m->fd_limit; ++index) {
@@ -692,7 +692,7 @@ static void thread_array_free(struct thread_master *m,
void thread_master_free_unused(struct thread_master *m)
{
frr_with_mutex (&m->mtx) {
- struct thread *t;
+ struct event *t;
while ((t = thread_list_pop(&m->unuse)))
thread_free(m, t);
}
@@ -701,7 +701,7 @@ void thread_master_free_unused(struct thread_master *m)
/* Stop thread scheduler. */
void thread_master_free(struct thread_master *m)
{
- struct thread *t;
+ struct event *t;
frr_with_mutex (&masters_mtx) {
listnode_delete(masters, m);
@@ -733,7 +733,7 @@ void thread_master_free(struct thread_master *m)
}
/* Return remain time in milliseconds. */
-unsigned long thread_timer_remain_msec(struct thread *thread)
+unsigned long thread_timer_remain_msec(struct event *thread)
{
int64_t remain;
@@ -748,12 +748,12 @@ unsigned long thread_timer_remain_msec(struct thread *thread)
}
/* Return remain time in seconds. */
-unsigned long thread_timer_remain_second(struct thread *thread)
+unsigned long thread_timer_remain_second(struct event *thread)
{
return thread_timer_remain_msec(thread) / 1000LL;
}
-struct timeval thread_timer_remain(struct thread *thread)
+struct timeval thread_timer_remain(struct event *thread)
{
struct timeval remain;
frr_with_mutex (&thread->mtx) {
@@ -780,8 +780,7 @@ static int time_hhmmss(char *buf, int buf_size, long sec)
return wr != 8;
}
-char *thread_timer_to_hhmmss(char *buf, int buf_size,
- struct thread *t_timer)
+char *thread_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer)
{
if (t_timer) {
time_hhmmss(buf, buf_size,
@@ -793,15 +792,15 @@ char *thread_timer_to_hhmmss(char *buf, int buf_size,
}
/* Get new thread. */
-static struct thread *thread_get(struct thread_master *m, uint8_t type,
- void (*func)(struct thread *), void *arg,
- const struct xref_threadsched *xref)
+static struct event *thread_get(struct thread_master *m, uint8_t type,
+ void (*func)(struct event *), void *arg,
+ const struct xref_threadsched *xref)
{
- struct thread *thread = thread_list_pop(&m->unuse);
+ struct event *thread = thread_list_pop(&m->unuse);
struct cpu_thread_history tmp;
if (!thread) {
- thread = XCALLOC(MTYPE_THREAD, sizeof(struct thread));
+ thread = XCALLOC(MTYPE_THREAD, sizeof(struct event));
/* mutex only needs to be initialized at struct creation. */
pthread_mutex_init(&thread->mtx, NULL);
m->alloc++;
@@ -840,7 +839,7 @@ static struct thread *thread_get(struct thread_master *m, uint8_t type,
return thread;
}
-static void thread_free(struct thread_master *master, struct thread *thread)
+static void thread_free(struct thread_master *master, struct event *thread)
{
/* Update statistics. */
assert(master->alloc > 0);
@@ -951,12 +950,12 @@ done:
/* Add new read thread. */
void _thread_add_read_write(const struct xref_threadsched *xref,
struct thread_master *m,
- void (*func)(struct thread *), void *arg, int fd,
- struct thread **t_ptr)
+ void (*func)(struct event *), void *arg, int fd,
+ struct event **t_ptr)
{
int dir = xref->thread_type;
- struct thread *thread = NULL;
- struct thread **thread_array;
+ struct event *thread = NULL;
+ struct event **thread_array;
if (dir == THREAD_READ)
frrtrace(9, frr_libfrr, schedule_read, m,
@@ -1031,11 +1030,11 @@ void _thread_add_read_write(const struct xref_threadsched *xref,
static void _thread_add_timer_timeval(const struct xref_threadsched *xref,
struct thread_master *m,
- void (*func)(struct thread *), void *arg,
+ void (*func)(struct event *), void *arg,
struct timeval *time_relative,
- struct thread **t_ptr)
+ struct event **t_ptr)
{
- struct thread *thread;
+ struct event *thread;
struct timeval t;
assert(m != NULL);
@@ -1084,8 +1083,8 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref,
/* Add timer event thread. */
void _thread_add_timer(const struct xref_threadsched *xref,
- struct thread_master *m, void (*func)(struct thread *),
- void *arg, long timer, struct thread **t_ptr)
+ struct thread_master *m, void (*func)(struct event *),
+ void *arg, long timer, struct event **t_ptr)
{
struct timeval trel;
@@ -1100,8 +1099,8 @@ void _thread_add_timer(const struct xref_threadsched *xref,
/* Add timer event thread with "millisecond" resolution */
void _thread_add_timer_msec(const struct xref_threadsched *xref,
struct thread_master *m,
- void (*func)(struct thread *), void *arg,
- long timer, struct thread **t_ptr)
+ void (*func)(struct event *), void *arg, long timer,
+ struct event **t_ptr)
{
struct timeval trel;
@@ -1115,19 +1114,18 @@ void _thread_add_timer_msec(const struct xref_threadsched *xref,
/* Add timer event thread with "timeval" resolution */
void _thread_add_timer_tv(const struct xref_threadsched *xref,
- struct thread_master *m,
- void (*func)(struct thread *), void *arg,
- struct timeval *tv, struct thread **t_ptr)
+ struct thread_master *m, void (*func)(struct event *),
+ void *arg, struct timeval *tv, struct event **t_ptr)
{
_thread_add_timer_timeval(xref, m, func, arg, tv, t_ptr);
}
/* Add simple event thread. */
void _thread_add_event(const struct xref_threadsched *xref,
- struct thread_master *m, void (*func)(struct thread *),
- void *arg, int val, struct thread **t_ptr)
+ struct thread_master *m, void (*func)(struct event *),
+ void *arg, int val, struct event **t_ptr)
{
- struct thread *thread = NULL;
+ struct event *thread = NULL;
frrtrace(9, frr_libfrr, schedule_event, m,
xref->funcname, xref->xref.file, xref->xref.line,
@@ -1240,7 +1238,7 @@ static void thread_cancel_rw(struct thread_master *master, int fd, short state,
static void cancel_arg_helper(struct thread_master *master,
const struct cancel_req *cr)
{
- struct thread *t;
+ struct event *t;
nfds_t i;
int fd;
struct pollfd *pfd;
@@ -1307,7 +1305,7 @@ static void cancel_arg_helper(struct thread_master *master,
/* Check the timer tasks */
t = thread_timer_list_first(&master->timer);
while (t) {
- struct thread *t_next;
+ struct event *t_next;
t_next = thread_timer_list_next(&master->timer, t);
@@ -1333,8 +1331,8 @@ static void cancel_arg_helper(struct thread_master *master,
static void do_thread_cancel(struct thread_master *master)
{
struct thread_list_head *list = NULL;
- struct thread **thread_array = NULL;
- struct thread *thread;
+ struct event **thread_array = NULL;
+ struct event *thread;
struct cancel_req *cr;
struct listnode *ln;
@@ -1467,7 +1465,7 @@ void thread_cancel_event_ready(struct thread_master *m, void *arg)
*
* @param thread task to cancel
*/
-void thread_cancel(struct thread **thread)
+void thread_cancel(struct event **thread)
{
struct thread_master *master;
@@ -1497,7 +1495,7 @@ void thread_cancel(struct thread **thread)
/**
* Asynchronous cancellation.
*
- * Called with either a struct thread ** or void * to an event argument,
+ * Called with either a struct event ** or void * to an event argument,
* this function posts the correct cancellation request and blocks until it is
* serviced.
*
@@ -1518,7 +1516,7 @@ void thread_cancel(struct thread **thread)
* @param thread pointer to thread to cancel
* @param eventobj the event
*/
-void thread_cancel_async(struct thread_master *master, struct thread **thread,
+void thread_cancel_async(struct thread_master *master, struct event **thread,
void *eventobj)
{
assert(!(thread && eventobj) && (thread || eventobj));
@@ -1566,13 +1564,13 @@ static struct timeval *thread_timer_wait(struct thread_timer_list_head *timers,
if (!thread_timer_list_count(timers))
return NULL;
- struct thread *next_timer = thread_timer_list_first(timers);
+ struct event *next_timer = thread_timer_list_first(timers);
monotime_until(&next_timer->u.sands, timer_val);
return timer_val;
}
-static struct thread *thread_run(struct thread_master *m, struct thread *thread,
- struct thread *fetch)
+static struct event *thread_run(struct thread_master *m, struct event *thread,
+ struct event *fetch)
{
*fetch = *thread;
thread_add_unuse(m, thread);
@@ -1580,10 +1578,10 @@ static struct thread *thread_run(struct thread_master *m, struct thread *thread,
}
static int thread_process_io_helper(struct thread_master *m,
- struct thread *thread, short state,
+ struct event *thread, short state,
short actual_state, int pos)
{
- struct thread **thread_array;
+ struct event **thread_array;
/*
* poll() clears the .events field, but the pollfd array we
@@ -1690,7 +1688,7 @@ static unsigned int thread_process_timers(struct thread_master *m,
{
struct timeval prev = *timenow;
bool displayed = false;
- struct thread *thread;
+ struct event *thread;
unsigned int ready = 0;
while ((thread = thread_timer_list_first(&m->timer))) {
@@ -1729,7 +1727,7 @@ static unsigned int thread_process_timers(struct thread_master *m,
/* process a list en masse, e.g. for event thread lists */
static unsigned int thread_process(struct thread_list_head *list)
{
- struct thread *thread;
+ struct event *thread;
unsigned int ready = 0;
while ((thread = thread_list_pop(list))) {
@@ -1742,9 +1740,9 @@ static unsigned int thread_process(struct thread_list_head *list)
/* Fetch next ready thread. */
-struct thread *thread_fetch(struct thread_master *m, struct thread *fetch)
+struct event *thread_fetch(struct thread_master *m, struct event *fetch)
{
- struct thread *thread = NULL;
+ struct event *thread = NULL;
struct timeval now;
struct timeval zerotime = {0, 0};
struct timeval tv;
@@ -1912,7 +1910,7 @@ unsigned long thread_consumed_time(RUSAGE_T *now, RUSAGE_T *start,
for CPU time. On balance, wall clock time seems to make sense.
Plus it has the added benefit that gettimeofday should be faster
than calling getrusage. */
-int thread_should_yield(struct thread *thread)
+int thread_should_yield(struct event *thread)
{
int result;
frr_with_mutex (&thread->mtx) {
@@ -1922,7 +1920,7 @@ int thread_should_yield(struct thread *thread)
return result;
}
-void thread_set_yield_time(struct thread *thread, unsigned long yield_time)
+void thread_set_yield_time(struct event *thread, unsigned long yield_time)
{
frr_with_mutex (&thread->mtx) {
thread->yield = yield_time;
@@ -1963,7 +1961,7 @@ void thread_getrusage(RUSAGE_T *r)
* particular, the maximum real and cpu times must be monotonically increasing
* or this code is not correct.
*/
-void thread_call(struct thread *thread)
+void thread_call(struct event *thread)
{
RUSAGE_T before, after;
@@ -2060,10 +2058,10 @@ void thread_call(struct thread *thread)
/* Execute thread */
void _thread_execute(const struct xref_threadsched *xref,
- struct thread_master *m, void (*func)(struct thread *),
+ struct thread_master *m, void (*func)(struct event *),
void *arg, int val)
{
- struct thread *thread;
+ struct event *thread;
/* Get or allocate new thread to execute. */
frr_with_mutex (&m->mtx) {
@@ -2131,7 +2129,7 @@ void debug_signals(const sigset_t *sigs)
}
static ssize_t printfrr_thread_dbg(struct fbuf *buf, struct printfrr_eargs *ea,
- const struct thread *thread)
+ const struct event *thread)
{
static const char * const types[] = {
[THREAD_READ] = "read",
@@ -2176,7 +2174,7 @@ printfrr_ext_autoreg_p("TH", printfrr_thread);
static ssize_t printfrr_thread(struct fbuf *buf, struct printfrr_eargs *ea,
const void *ptr)
{
- const struct thread *thread = ptr;
+ const struct event *thread = ptr;
struct timespec remain = {};
if (ea->fmt[0] == 'D') {
diff --git a/lib/event.h b/lib/event.h
index 128d11b6e..e1d3ad68a 100644
--- a/lib/event.h
+++ b/lib/event.h
@@ -69,8 +69,8 @@ struct xref_threadsched {
struct thread_master {
char *name;
- struct thread **read;
- struct thread **write;
+ struct event **read;
+ struct event **write;
struct thread_timer_list_head timer;
struct thread_list_head event, ready, unuse;
struct list *cancel_req;
@@ -92,14 +92,14 @@ struct thread_master {
};
/* Thread itself. */
-struct thread {
+struct event {
uint8_t type; /* thread type */
uint8_t add_type; /* thread type */
struct thread_list_item threaditem;
struct thread_timer_list_item timeritem;
- struct thread **ref; /* external reference (if given) */
+ struct event **ref; /* external reference (if given) */
struct thread_master *master; /* pointer to the struct thread_master */
- void (*func)(struct thread *); /* event function */
+ void (*func)(struct event *); /* event function */
void *arg; /* event argument */
union {
int val; /* second argument of the event. */
@@ -115,11 +115,11 @@ struct thread {
};
#ifdef _FRR_ATTRIBUTE_PRINTFRR
-#pragma FRR printfrr_ext "%pTH" (struct thread *)
+#pragma FRR printfrr_ext "%pTH"(struct event *)
#endif
struct cpu_thread_history {
- void (*func)(struct thread *);
+ void (*func)(struct event *);
atomic_size_t total_cpu_warn;
atomic_size_t total_wall_warn;
atomic_size_t total_starv_warn;
@@ -212,48 +212,48 @@ extern void thread_master_free_unused(struct thread_master *);
extern void _thread_add_read_write(const struct xref_threadsched *xref,
struct thread_master *master,
- void (*fn)(struct thread *), void *arg,
- int fd, struct thread **tref);
+ void (*fn)(struct event *), void *arg,
+ int fd, struct event **tref);
extern void _thread_add_timer(const struct xref_threadsched *xref,
struct thread_master *master,
- void (*fn)(struct thread *), void *arg, long t,
- struct thread **tref);
+ void (*fn)(struct event *), void *arg, long t,
+ struct event **tref);
extern void _thread_add_timer_msec(const struct xref_threadsched *xref,
struct thread_master *master,
- void (*fn)(struct thread *), void *arg,
- long t, struct thread **tref);
+ void (*fn)(struct event *), void *arg,
+ long t, struct event **tref);
extern void _thread_add_timer_tv(const struct xref_threadsched *xref,
struct thread_master *master,
- void (*fn)(struct thread *), void *arg,
- struct timeval *tv, struct thread **tref);
+ void (*fn)(struct event *), void *arg,
+ struct timeval *tv, struct event **tref);
extern void _thread_add_event(const struct xref_threadsched *xref,
struct thread_master *master,
- void (*fn)(struct thread *), void *arg, int val,
- struct thread **tref);
+ void (*fn)(struct event *), void *arg, int val,
+ struct event **tref);
extern void _thread_execute(const struct xref_threadsched *xref,
struct thread_master *master,
- void (*fn)(struct thread *), void *arg, int val);
+ void (*fn)(struct event *), void *arg, int val);
-extern void thread_cancel(struct thread **event);
-extern void thread_cancel_async(struct thread_master *, struct thread **,
+extern void thread_cancel(struct event **event);
+extern void thread_cancel_async(struct thread_master *, struct event **,
void *);
/* Cancel ready tasks with an arg matching 'arg' */
extern void thread_cancel_event_ready(struct thread_master *m, void *arg);
/* Cancel all tasks with an arg matching 'arg', including timers and io */
extern void thread_cancel_event(struct thread_master *m, void *arg);
-extern struct thread *thread_fetch(struct thread_master *, struct thread *);
-extern void thread_call(struct thread *);
-extern unsigned long thread_timer_remain_second(struct thread *);
-extern struct timeval thread_timer_remain(struct thread *);
-extern unsigned long thread_timer_remain_msec(struct thread *);
-extern int thread_should_yield(struct thread *);
+extern struct event *thread_fetch(struct thread_master *, struct event *event);
+extern void thread_call(struct event *event);
+extern unsigned long thread_timer_remain_second(struct event *event);
+extern struct timeval thread_timer_remain(struct event *event);
+extern unsigned long thread_timer_remain_msec(struct event *event);
+extern int thread_should_yield(struct event *event);
/* set yield time for thread */
-extern void thread_set_yield_time(struct thread *, unsigned long);
+extern void thread_set_yield_time(struct event *event, unsigned long);
/* Internal libfrr exports */
extern void thread_getrusage(RUSAGE_T *);
@@ -266,9 +266,9 @@ extern unsigned long thread_consumed_time(RUSAGE_T *after, RUSAGE_T *before,
/* only for use in logging functions! */
extern pthread_key_t thread_current;
extern char *thread_timer_to_hhmmss(char *buf, int buf_size,
- struct thread *t_timer);
+ struct event *t_timer);
-static inline bool thread_is_scheduled(struct thread *thread)
+static inline bool thread_is_scheduled(struct event *thread)
{
if (thread)
return true;
@@ -279,9 +279,9 @@ static inline bool thread_is_scheduled(struct thread *thread)
/* Debug signal mask */
void debug_signals(const sigset_t *sigs);
-static inline void thread_ignore_late_timer(struct thread *thread)
+static inline void thread_ignore_late_timer(struct event *event)
{
- thread->ignore_timer_late = true;
+ event->ignore_timer_late = true;
}
#ifdef __cplusplus
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c
index 0c617238f..9f026868d 100644
--- a/lib/frr_pthread.c
+++ b/lib/frr_pthread.c
@@ -224,12 +224,12 @@ void frr_pthread_stop_all(void)
*/
/* dummy task for sleeper pipe */
-static void fpt_dummy(struct thread *thread)
+static void fpt_dummy(struct event *thread)
{
}
/* poison pill task to end event loop */
-static void fpt_finish(struct thread *thread)
+static void fpt_finish(struct event *thread)
{
struct frr_pthread *fpt = THREAD_ARG(thread);
@@ -289,7 +289,7 @@ static void *fpt_run(void *arg)
frr_pthread_notify_running(fpt);
- struct thread task;
+ struct event task;
while (atomic_load_explicit(&fpt->running, memory_order_relaxed)) {
pthread_testcancel();
if (thread_fetch(fpt->master, &task)) {
diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c
index 525e49942..30c51230c 100644
--- a/lib/frr_zmq.c
+++ b/lib/frr_zmq.c
@@ -43,7 +43,7 @@ void frrzmq_finish(void)
}
}
-static void frrzmq_read_msg(struct thread *t)
+static void frrzmq_read_msg(struct event *t)
{
struct frrzmq_cb **cbp = THREAD_ARG(t);
struct frrzmq_cb *cb;
@@ -201,7 +201,7 @@ int _frrzmq_thread_add_read(const struct xref_threadsched *xref,
return 0;
}
-static void frrzmq_write_msg(struct thread *t)
+static void frrzmq_write_msg(struct event *t)
{
struct frrzmq_cb **cbp = THREAD_ARG(t);
struct frrzmq_cb *cb;
diff --git a/lib/frr_zmq.h b/lib/frr_zmq.h
index bfc1e93b1..d90088edb 100644
--- a/lib/frr_zmq.h
+++ b/lib/frr_zmq.h
@@ -26,7 +26,7 @@ extern "C" {
/* callback integration */
struct cb_core {
- struct thread *thread;
+ struct event *thread;
void *arg;
bool cancelled;
diff --git a/lib/grammar_sandbox_main.c b/lib/grammar_sandbox_main.c
index cdb1c3adb..261a13063 100644
--- a/lib/grammar_sandbox_main.c
+++ b/lib/grammar_sandbox_main.c
@@ -27,7 +27,7 @@ struct thread_master *master;
int main(int argc, char **argv)
{
- struct thread thread;
+ struct event event;
master = thread_master_create(NULL);
@@ -45,8 +45,8 @@ int main(int argc, char **argv)
vty_stdio(vty_do_exit);
/* Fetch next active thread. */
- while (thread_fetch(master, &thread))
- thread_call(&thread);
+ while (thread_fetch(master, &event))
+ thread_call(&event);
/* Not reached. */
exit(0);
diff --git a/lib/ldp_sync.h b/lib/ldp_sync.h
index 5b6ebbf88..f7601ebf9 100644
--- a/lib/ldp_sync.h
+++ b/lib/ldp_sync.h
@@ -37,7 +37,7 @@ struct ldp_sync_info {
uint8_t enabled; /* enabled */
uint8_t state; /* running state */
uint16_t holddown; /* timer value */
- struct thread *t_holddown; /* holddown timer*/
+ struct event *t_holddown; /* holddown timer*/
uint32_t metric[2]; /* isis interface metric */
};
diff --git a/lib/libfrr.c b/lib/libfrr.c
index d1b7dd133..433e9cb14 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -964,7 +964,7 @@ static void frr_daemonize(void)
* to read the config in after thread execution starts, so that
* we can match this behavior.
*/
-static void frr_config_read_in(struct thread *t)
+static void frr_config_read_in(struct event *t)
{
hook_call(frr_config_pre, master);
@@ -1095,9 +1095,9 @@ static void frr_terminal_close(int isexit)
}
}
-static struct thread *daemon_ctl_thread = NULL;
+static struct event *daemon_ctl_thread = NULL;
-static void frr_daemon_ctl(struct thread *t)
+static void frr_daemon_ctl(struct event *t)
{
char buf[1];
ssize_t nr;
@@ -1180,7 +1180,7 @@ void frr_run(struct thread_master *master)
/* end fixed stderr startup logging */
zlog_startup_end();
- struct thread thread;
+ struct event thread;
while (thread_fetch(master, &thread))
thread_call(&thread);
}
diff --git a/lib/libfrr.h b/lib/libfrr.h
index 365734650..5463222d7 100644
--- a/lib/libfrr.h
+++ b/lib/libfrr.h
@@ -70,7 +70,7 @@ struct frr_daemon_info {
bool terminal;
enum frr_cli_mode cli_mode;
- struct thread *read_in;
+ struct event *read_in;
const char *config_file;
const char *backup_config_file;
const char *pid_file;
diff --git a/lib/libfrr_trace.h b/lib/libfrr_trace.h
index d13cdc20b..2a1bb2f6c 100644
--- a/lib/libfrr_trace.h
+++ b/lib/libfrr_trace.h
@@ -74,7 +74,7 @@ TRACEPOINT_LOGLEVEL(frr_libfrr, hash_release, TRACE_INFO)
#define THREAD_SCHEDULE_ARGS \
TP_ARGS(struct thread_master *, master, const char *, funcname, \
- const char *, schedfrom, int, fromln, struct thread **, \
+ const char *, schedfrom, int, fromln, struct event **, \
thread_ptr, int, fd, int, val, void *, arg, long, time)
TRACEPOINT_EVENT_CLASS(
diff --git a/lib/log.c b/lib/log.c
index f7ab86fd9..00b897dca 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -140,7 +140,7 @@ void zlog_signal(int signo, const char *action, void *siginfo_v,
fb.pos = buf;
- struct thread *tc;
+ struct event *tc;
tc = pthread_getspecific(thread_current);
if (!tc)
@@ -284,7 +284,7 @@ void zlog_backtrace(int priority)
void zlog_thread_info(int log_level)
{
- struct thread *tc;
+ struct event *tc;
tc = pthread_getspecific(thread_current);
if (tc)
diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c
index bb45024d0..b70c00635 100644
--- a/lib/mgmt_be_client.c
+++ b/lib/mgmt_be_client.c
@@ -106,11 +106,11 @@ DECLARE_LIST(mgmt_be_txns, struct mgmt_be_txn_ctx, list_linkage);
struct mgmt_be_client_ctx {
int conn_fd;
struct thread_master *tm;
- struct thread *conn_retry_tmr;
- struct thread *conn_read_ev;
- struct thread *conn_write_ev;
- struct thread *conn_writes_on;
- struct thread *msg_proc_ev;
+ struct event *conn_retry_tmr;
+ struct event *conn_read_ev;
+ struct event *conn_write_ev;
+ struct event *conn_writes_on;
+ struct event *msg_proc_ev;
uint32_t flags;
struct mgmt_msg_state mstate;
@@ -897,7 +897,7 @@ static void mgmt_be_client_process_msg(void *user_ctx, uint8_t *data,
mgmtd__be_message__free_unpacked(be_msg, NULL);
}
-static void mgmt_be_client_proc_msgbufs(struct thread *thread)
+static void mgmt_be_client_proc_msgbufs(struct event *thread)
{
struct mgmt_be_client_ctx *client_ctx = THREAD_ARG(thread);
@@ -906,7 +906,7 @@ static void mgmt_be_client_proc_msgbufs(struct thread *thread)
mgmt_be_client_register_event(client_ctx, MGMTD_BE_PROC_MSG);
}
-static void mgmt_be_client_read(struct thread *thread)
+static void mgmt_be_client_read(struct event *thread)
{
struct mgmt_be_client_ctx *client_ctx = THREAD_ARG(thread);
enum mgmt_msg_rsched rv;
@@ -962,7 +962,7 @@ static int mgmt_be_client_send_msg(struct mgmt_be_client_ctx *client_ctx,
return rv;
}
-static void mgmt_be_client_write(struct thread *thread)
+static void mgmt_be_client_write(struct event *thread)
{
struct mgmt_be_client_ctx *client_ctx = THREAD_ARG(thread);
enum mgmt_msg_wsched rv;
@@ -981,7 +981,7 @@ static void mgmt_be_client_write(struct thread *thread)
assert(rv == MSW_SCHED_NONE);
}
-static void mgmt_be_client_resume_writes(struct thread *thread)
+static void mgmt_be_client_resume_writes(struct event *thread)
{
struct mgmt_be_client_ctx *client_ctx;
@@ -1040,7 +1040,7 @@ static void mgmt_be_server_connect(struct mgmt_be_client_ctx *client_ctx)
client_ctx->client_params.user_data, true);
}
-static void mgmt_be_client_conn_timeout(struct thread *thread)
+static void mgmt_be_client_conn_timeout(struct event *thread)
{
mgmt_be_server_connect(THREAD_ARG(thread));
}
diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c
index 362492212..c0d897ab2 100644
--- a/lib/mgmt_fe_client.c
+++ b/lib/mgmt_fe_client.c
@@ -50,11 +50,11 @@ DEFINE_MTYPE_STATIC(LIB, MGMTD_FE_SESSION, "MGMTD Frontend session");
struct mgmt_fe_client_ctx {
int conn_fd;
struct thread_master *tm;
- struct thread *conn_retry_tmr;
- struct thread *conn_read_ev;
- struct thread *conn_write_ev;
- struct thread *conn_writes_on;
- struct thread *msg_proc_ev;
+ struct event *conn_retry_tmr;
+ struct event *conn_read_ev;
+ struct event *conn_write_ev;
+ struct event *conn_writes_on;
+ struct event *msg_proc_ev;
uint32_t flags;
struct mgmt_msg_state mstate;
@@ -174,7 +174,7 @@ static int mgmt_fe_client_send_msg(struct mgmt_fe_client_ctx *client_ctx,
return rv;
}
-static void mgmt_fe_client_write(struct thread *thread)
+static void mgmt_fe_client_write(struct event *thread)
{
struct mgmt_fe_client_ctx *client_ctx;
enum mgmt_msg_wsched rv;
@@ -194,7 +194,7 @@ static void mgmt_fe_client_write(struct thread *thread)
assert(rv == MSW_SCHED_NONE);
}
-static void mgmt_fe_client_resume_writes(struct thread *thread)
+static void mgmt_fe_client_resume_writes(struct event *thread)
{
struct mgmt_fe_client_ctx *client_ctx;
@@ -670,7 +670,7 @@ static void mgmt_fe_client_process_msg(void *user_ctx, uint8_t *data,
mgmtd__fe_message__free_unpacked(fe_msg, NULL);
}
-static void mgmt_fe_client_proc_msgbufs(struct thread *thread)
+static void mgmt_fe_client_proc_msgbufs(struct event *thread)
{
struct mgmt_fe_client_ctx *client_ctx;
@@ -680,7 +680,7 @@ static void mgmt_fe_client_proc_msgbufs(struct thread *thread)
mgmt_fe_client_register_event(client_ctx, MGMTD_FE_PROC_MSG);
}
-static void mgmt_fe_client_read(struct thread *thread)
+static void mgmt_fe_client_read(struct event *thread)
{
struct mgmt_fe_client_ctx *client_ctx;
enum mgmt_msg_rsched rv;
@@ -725,7 +725,7 @@ static void mgmt_fe_server_connect(struct mgmt_fe_client_ctx *client_ctx)
}
-static void mgmt_fe_client_conn_timeout(struct thread *thread)
+static void mgmt_fe_client_conn_timeout(struct event *thread)
{
mgmt_fe_server_connect(THREAD_ARG(thread));
}
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c
index 281d9a470..6d0ee100b 100644
--- a/lib/northbound_cli.c
+++ b/lib/northbound_cli.c
@@ -300,7 +300,7 @@ int nb_cli_confirmed_commit_rollback(struct vty *vty)
return ret;
}
-static void nb_cli_confirmed_commit_timeout(struct thread *thread)
+static void nb_cli_confirmed_commit_timeout(struct event *thread)
{
struct vty *vty = THREAD_ARG(thread);
diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c
index ee1956851..f0084e576 100644
--- a/lib/northbound_confd.c
+++ b/lib/northbound_confd.c
@@ -26,7 +26,7 @@ static struct debug nb_dbg_client_confd = {0, "Northbound client: ConfD"};
static struct thread_master *master;
static struct sockaddr confd_addr;
static int cdb_sub_sock, dp_ctl_sock, dp_worker_sock;
-static struct thread *t_cdb_sub, *t_dp_ctl, *t_dp_worker;
+static struct event *t_cdb_sub, *t_dp_ctl, *t_dp_worker;
static struct confd_daemon_ctx *dctx;
static struct confd_notification_ctx *live_ctx;
static bool confd_connected;
@@ -401,7 +401,7 @@ static int frr_confd_cdb_read_cb_abort(int fd, int *subp, int reslen)
return 0;
}
-static void frr_confd_cdb_read_cb(struct thread *thread)
+static void frr_confd_cdb_read_cb(struct event *thread)
{
int fd = THREAD_FD(thread);
enum cdb_sub_notification cdb_ev;
@@ -1173,7 +1173,7 @@ static int frr_confd_dp_read(struct confd_daemon_ctx *dctx, int fd)
return 0;
}
-static void frr_confd_dp_ctl_read(struct thread *thread)
+static void frr_confd_dp_ctl_read(struct event *thread)
{
struct confd_daemon_ctx *dctx = THREAD_ARG(thread);
int fd = THREAD_FD(thread);
@@ -1183,7 +1183,7 @@ static void frr_confd_dp_ctl_read(struct thread *thread)
frr_confd_dp_read(dctx, fd);
}
-static void frr_confd_dp_worker_read(struct thread *thread)
+static void frr_confd_dp_worker_read(struct event *thread)
{
struct confd_daemon_ctx *dctx = THREAD_ARG(thread);
int fd = THREAD_FD(thread);
diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp
index d68e22368..4de2b0e33 100644
--- a/lib/northbound_grpc.cpp
+++ b/lib/northbound_grpc.cpp
@@ -181,9 +181,9 @@ class RpcStateBase
}
protected:
- virtual CallState run_mainthread(struct thread *thread) = 0;
+ virtual CallState run_mainthread(struct event *thread) = 0;
- static void c_callback(struct thread *thread)
+ static void c_callback(struct event *thread)
{
auto _tag = static_cast<RpcStateBase *>(THREAD_ARG(thread));
/*
@@ -250,7 +250,7 @@ template <typename Q, typename S> class UnaryRpcState : public RpcStateBase
&copy->responder, cq, cq, copy);
}
- CallState run_mainthread(struct thread *thread) override
+ CallState run_mainthread(struct event *thread) override
{
// Unary RPC are always finished, see "Unary" :)
grpc::Status status = this->callback(this);
@@ -302,7 +302,7 @@ class StreamRpcState : public RpcStateBase
&copy->async_responder, cq, cq, copy);
}
- CallState run_mainthread(struct thread *thread) override
+ CallState run_mainthread(struct event *thread) override
{
if (this->callback(this))
return MORE;
@@ -1275,7 +1275,7 @@ static int frr_grpc_finish(void)
* fork. This is done by scheduling this init function as an event task, since
* the event loop doesn't run until after fork.
*/
-static void frr_grpc_module_very_late_init(struct thread *thread)
+static void frr_grpc_module_very_late_init(struct event *thread)
{
const char *args = THIS_MODULE->load_args;
uint port = GRPC_DEFAULT_PORT;
diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c
index 337fb690d..9b0d2817d 100644
--- a/lib/northbound_sysrepo.c
+++ b/lib/northbound_sysrepo.c
@@ -28,7 +28,7 @@ static sr_session_ctx_t *session;
static sr_conn_ctx_t *connection;
static struct nb_transaction *transaction;
-static void frr_sr_read_cb(struct thread *thread);
+static void frr_sr_read_cb(struct event *thread);
static int frr_sr_finish(void);
/* Convert FRR YANG data value to sysrepo YANG data value. */
@@ -514,7 +514,7 @@ static int frr_sr_notification_send(const char *xpath, struct list *arguments)
return NB_OK;
}
-static void frr_sr_read_cb(struct thread *thread)
+static void frr_sr_read_cb(struct event *thread)
{
struct yang_module *module = THREAD_ARG(thread);
int fd = THREAD_FD(thread);
diff --git a/lib/pullwr.c b/lib/pullwr.c
index 5bc566c28..de07ca168 100644
--- a/lib/pullwr.c
+++ b/lib/pullwr.c
@@ -18,7 +18,7 @@ struct pullwr {
int fd;
struct thread_master *tm;
/* writer == NULL <=> we're idle */
- struct thread *writer;
+ struct event *writer;
void *arg;
void (*fill)(void *, struct pullwr *);
@@ -38,7 +38,7 @@ struct pullwr {
DEFINE_MTYPE_STATIC(LIB, PULLWR_HEAD, "pull-driven write controller");
DEFINE_MTYPE_STATIC(LIB, PULLWR_BUF, "pull-driven write buffer");
-static void pullwr_run(struct thread *t);
+static void pullwr_run(struct event *t);
struct pullwr *_pullwr_new(struct thread_master *tm, int fd,
void *arg,
@@ -176,7 +176,7 @@ void pullwr_write(struct pullwr *pullwr, const void *data, size_t len)
pullwr_bump(pullwr);
}
-static void pullwr_run(struct thread *t)
+static void pullwr_run(struct event *t)
{
struct pullwr *pullwr = THREAD_ARG(t);
struct iovec iov[2];
diff --git a/lib/resolver.c b/lib/resolver.c
index ffc84e5fe..c455b9bd2 100644
--- a/lib/resolver.c
+++ b/lib/resolver.c
@@ -24,7 +24,7 @@ XREF_SETUP();
struct resolver_state {
ares_channel channel;
struct thread_master *master;
- struct thread *timeout;
+ struct event *timeout;
};
static struct resolver_state state;
@@ -47,7 +47,7 @@ struct resolver_fd {
int fd;
struct resolver_state *state;
- struct thread *t_read, *t_write;
+ struct event *t_read, *t_write;
};
static int resolver_fd_cmp(const struct resolver_fd *a,
@@ -100,7 +100,7 @@ static void resolver_fd_drop_maybe(struct resolver_fd *resfd)
static void resolver_update_timeouts(struct resolver_state *r);
-static void resolver_cb_timeout(struct thread *t)
+static void resolver_cb_timeout(struct event *t)
{
struct resolver_state *r = THREAD_ARG(t);
@@ -108,7 +108,7 @@ static void resolver_cb_timeout(struct thread *t)
resolver_update_timeouts(r);
}
-static void resolver_cb_socket_readable(struct thread *t)
+static void resolver_cb_socket_readable(struct event *t)
{
struct resolver_fd *resfd = THREAD_ARG(t);
struct resolver_state *r = resfd->state;
@@ -123,7 +123,7 @@ static void resolver_cb_socket_readable(struct thread *t)
resolver_update_timeouts(r);
}
-static void resolver_cb_socket_writable(struct thread *t)
+static void resolver_cb_socket_writable(struct event *t)
{
struct resolver_fd *resfd = THREAD_ARG(t);
struct resolver_state *r = resfd->state;
@@ -222,7 +222,7 @@ static void ares_address_cb(void *arg, int status, int timeouts,
callback(query, NULL, i, &addr[0]);
}
-static void resolver_cb_literal(struct thread *t)
+static void resolver_cb_literal(struct event *t)
{
struct resolver_query *query = THREAD_ARG(t);
void (*callback)(struct resolver_query *, const char *, int,
diff --git a/lib/resolver.h b/lib/resolver.h
index 764e3e72a..6e69fa263 100644
--- a/lib/resolver.h
+++ b/lib/resolver.h
@@ -19,7 +19,7 @@ struct resolver_query {
/* used to immediate provide the result if IP literal is passed in */
union sockunion literal_addr;
- struct thread *literal_cb;
+ struct event *literal_cb;
};
void resolver_init(struct thread_master *tm);
diff --git a/lib/sigevent.c b/lib/sigevent.c
index 3ed34894e..40da4f3fc 100644
--- a/lib/sigevent.c
+++ b/lib/sigevent.c
@@ -22,7 +22,7 @@
/* master signals descriptor struct */
static struct frr_sigevent_master_t {
- struct thread *t;
+ struct event *t;
struct frr_signal_t *signals;
int sigc;
@@ -127,7 +127,7 @@ int frr_sigevent_process(void)
#ifdef SIGEVENT_SCHEDULE_THREAD
/* timer thread to check signals. shouldn't be needed */
-void frr_signal_timer(struct thread *t)
+void frr_signal_timer(struct event *t)
{
struct frr_sigevent_master_t *sigm;
diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c
index 36b059a99..b77f782ee 100644
--- a/lib/spf_backoff.c
+++ b/lib/spf_backoff.c
@@ -48,8 +48,8 @@ struct spf_backoff {
/* State machine */
enum spf_backoff_state state;
- struct thread *t_holddown;
- struct thread *t_timetolearn;
+ struct event *t_holddown;
+ struct event *t_timetolearn;
/* For debugging */
char *name;
@@ -104,7 +104,7 @@ void spf_backoff_free(struct spf_backoff *backoff)
XFREE(MTYPE_SPF_BACKOFF, backoff);
}
-static void spf_backoff_timetolearn_elapsed(struct thread *thread)
+static void spf_backoff_timetolearn_elapsed(struct event *thread)
{
struct spf_backoff *backoff = THREAD_ARG(thread);
@@ -113,7 +113,7 @@ static void spf_backoff_timetolearn_elapsed(struct thread *thread)
backoff->name, spf_backoff_state2str(backoff->state));
}
-static void spf_backoff_holddown_elapsed(struct thread *thread)
+static void spf_backoff_holddown_elapsed(struct event *thread)
{
struct spf_backoff *backoff = THREAD_ARG(thread);
diff --git a/lib/systemd.c b/lib/systemd.c
index 458bea514..14a09362d 100644
--- a/lib/systemd.c
+++ b/lib/systemd.c
@@ -65,7 +65,7 @@ void systemd_send_stopping(void)
static struct thread_master *systemd_master = NULL;
-static void systemd_send_watchdog(struct thread *t)
+static void systemd_send_watchdog(struct event *t)
{
systemd_send_information("WATCHDOG=1");
diff --git a/lib/vty.c b/lib/vty.c
index c6bc29d96..aaf7db0f8 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -81,7 +81,7 @@ struct vty_serv {
int sock;
bool vtysh;
- struct thread *t_accept;
+ struct event *t_accept;
};
DECLARE_DLIST(vtyservs, struct vty_serv, itm);
@@ -1360,7 +1360,7 @@ static void vty_buffer_reset(struct vty *vty)
}
/* Read data via vty socket. */
-static void vty_read(struct thread *thread)
+static void vty_read(struct event *thread)
{
int i;
int nbytes;
@@ -1563,7 +1563,7 @@ static void vty_read(struct thread *thread)
}
/* Flush buffer to the vty. */
-static void vty_flush(struct thread *thread)
+static void vty_flush(struct event *thread)
{
int erase;
buffer_status_t flushrc;
@@ -1823,7 +1823,7 @@ struct vty *vty_stdio(void (*atclose)(int isexit))
}
/* Accept connection from the network. */
-static void vty_accept(struct thread *thread)
+static void vty_accept(struct event *thread)
{
struct vty_serv *vtyserv = THREAD_ARG(thread);
int vty_sock;
@@ -2036,7 +2036,7 @@ static void vty_serv_un(const char *path)
/* #define VTYSH_DEBUG 1 */
-static void vtysh_accept(struct thread *thread)
+static void vtysh_accept(struct event *thread)
{
struct vty_serv *vtyserv = THREAD_ARG(thread);
int accept_sock = vtyserv->sock;
@@ -2166,7 +2166,7 @@ void vty_pass_fd(struct vty *vty, int fd)
vty->pass_fd = fd;
}
-static void vtysh_read(struct thread *thread)
+static void vtysh_read(struct event *thread)
{
int ret;
int sock;
@@ -2275,7 +2275,7 @@ static void vtysh_read(struct thread *thread)
vty_event(VTYSH_READ, vty);
}
-static void vtysh_write(struct thread *thread)
+static void vtysh_write(struct event *thread)
{
struct vty *vty = THREAD_ARG(thread);
@@ -2382,7 +2382,7 @@ void vty_close(struct vty *vty)
}
/* When time out occur output message then close connection. */
-static void vty_timeout(struct thread *thread)
+static void vty_timeout(struct event *thread)
{
struct vty *vty;
diff --git a/lib/vty.h b/lib/vty.h
index 52453d0da..856c352be 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -148,7 +148,7 @@ struct vty {
size_t pending_cmds_bufpos;
/* Confirmed-commit timeout and rollback configuration. */
- struct thread *t_confirmed_commit_timeout;
+ struct event *t_confirmed_commit_timeout;
struct nb_config *confirmed_commit_rollback;
/* qobj object ID (replacement for "index") */
@@ -202,12 +202,12 @@ struct vty {
int lines;
/* Read and write thread. */
- struct thread *t_read;
- struct thread *t_write;
+ struct event *t_read;
+ struct event *t_write;
/* Timeout seconds and thread. */
unsigned long v_timeout;
- struct thread *t_timeout;
+ struct event *t_timeout;
/* What address is this vty comming from. */
char address[SU_ADDRSTRLEN];
diff --git a/lib/wheel.c b/lib/wheel.c
index bd12105a3..363b27ab1 100644
--- a/lib/wheel.c
+++ b/lib/wheel.c
@@ -16,9 +16,9 @@ DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL_LIST, "Timer Wheel Slot List");
static int debug_timer_wheel = 0;
-static void wheel_timer_thread(struct thread *t);
+static void wheel_timer_thread(struct event *t);
-static void wheel_timer_thread_helper(struct thread *t)
+static void wheel_timer_thread_helper(struct event *t)
{
struct listnode *node, *nextnode;
unsigned long long curr_slot;
@@ -51,7 +51,7 @@ static void wheel_timer_thread_helper(struct thread *t)
wheel->nexttime * slots_to_skip, &wheel->timer);
}
-static void wheel_timer_thread(struct thread *t)
+static void wheel_timer_thread(struct event *t)
{
struct timer_wheel *wheel;
diff --git a/lib/wheel.h b/lib/wheel.h
index 9aa808cdf..f4e72af9d 100644
--- a/lib/wheel.h
+++ b/lib/wheel.h
@@ -21,7 +21,7 @@ struct timer_wheel {
unsigned int slots_to_skip;
struct list **wheel_slot_lists;
- struct thread *timer;
+ struct event *timer;
/*
* Key to determine what slot the item belongs in
*/
diff --git a/lib/workqueue.c b/lib/workqueue.c
index e1ab4c48d..50a0ad388 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -218,7 +218,7 @@ void work_queue_unplug(struct work_queue *wq)
* will reschedule itself if required,
* otherwise work_queue_item_add
*/
-void work_queue_run(struct thread *thread)
+void work_queue_run(struct event *thread)
{
struct work_queue *wq;
struct work_queue_item *item, *titem;
diff --git a/lib/workqueue.h b/lib/workqueue.h
index c7ed14b05..f3c8fc813 100644
--- a/lib/workqueue.h
+++ b/lib/workqueue.h
@@ -48,7 +48,7 @@ struct work_queue {
* the following may be read
*/
struct thread_master *master; /* thread master */
- struct thread *thread; /* thread, if one is active */
+ struct event *thread; /* thread, if one is active */
char *name; /* work queue name */
/* Specification for this work queue.
@@ -158,7 +158,7 @@ extern void work_queue_unplug(struct work_queue *wq);
bool work_queue_is_scheduled(struct work_queue *wq);
/* Helpers, exported for thread.c and command.c */
-extern void work_queue_run(struct thread *thread);
+extern void work_queue_run(struct event *thread);
extern void workqueue_cmd_init(void);
diff --git a/lib/yang.h b/lib/yang.h
index 91cd641ce..654c246f0 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -50,7 +50,7 @@ struct yang_module {
#endif
#ifdef HAVE_SYSREPO
sr_subscription_ctx_t *sr_subscription;
- struct thread *sr_thread;
+ struct event *sr_thread;
#endif
};
RB_HEAD(yang_modules, yang_module);
diff --git a/lib/zclient.c b/lib/zclient.c
index 2cd80cc58..bb5d66df5 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -249,7 +249,7 @@ static enum zclient_send_status zclient_failed(struct zclient *zclient)
return ZCLIENT_SEND_FAILURE;
}
-static void zclient_flush_data(struct thread *thread)
+static void zclient_flush_data(struct event *thread)
{
struct zclient *zclient = THREAD_ARG(thread);
@@ -744,7 +744,7 @@ void zclient_init(struct zclient *zclient, int redist_default,
/* This function is a wrapper function for calling zclient_start from
timer or event thread. */
-static void zclient_connect(struct thread *t)
+static void zclient_connect(struct event *t)
{
struct zclient *zclient;
@@ -4026,7 +4026,7 @@ static zclient_handler *const lib_handlers[] = {
};
/* Zebra client message read function. */
-static void zclient_read(struct thread *thread)
+static void zclient_read(struct event *thread)
{
size_t already;
uint16_t length, command;
diff --git a/lib/zclient.h b/lib/zclient.h
index 53c7038c8..5daae3f5b 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -323,11 +323,11 @@ struct zclient {
struct buffer *wb;
/* Read and connect thread. */
- struct thread *t_read;
- struct thread *t_connect;
+ struct event *t_read;
+ struct event *t_connect;
/* Thread to write buffered data to zebra. */
- struct thread *t_write;
+ struct event *t_write;
/* Redistribute information. */
uint8_t redist_default; /* clients protocol */
diff --git a/lib/zlog.c b/lib/zlog.c
index d379ff8d3..618325d09 100644
--- a/lib/zlog.c
+++ b/lib/zlog.c
@@ -506,7 +506,7 @@ static void vzlog_tls(struct zlog_tls *zlog_tls, const struct xref_logmsg *xref,
static void zlog_backtrace_msg(const struct xref_logmsg *xref, int prio)
{
- struct thread *tc = pthread_getspecific(thread_current);
+ struct event *tc = pthread_getspecific(thread_current);
const char *uid = xref->xref.xrefdata->uid;
bool found_thread = false;
diff --git a/lib/zlog_5424.c b/lib/zlog_5424.c
index 23cad0034..14b6396b8 100644
--- a/lib/zlog_5424.c
+++ b/lib/zlog_5424.c
@@ -789,7 +789,7 @@ static void zlog_5424_cycle(struct zlog_cfg_5424 *zcf, int fd)
rcu_free(MTYPE_LOG_5424, oldt, zt.rcu_head);
}
-static void zlog_5424_reconnect(struct thread *t)
+static void zlog_5424_reconnect(struct event *t)
{
struct zlog_cfg_5424 *zcf = THREAD_ARG(t);
int fd = THREAD_FD(t);
diff --git a/lib/zlog_5424.h b/lib/zlog_5424.h
index 377e7be22..e8a15bd49 100644
--- a/lib/zlog_5424.h
+++ b/lib/zlog_5424.h
@@ -13,7 +13,7 @@
#include "zlog_targets.h"
#include "qobj.h"
-struct thread;
+struct event;
struct thread_master;
enum zlog_5424_dst {
@@ -79,7 +79,7 @@ struct zlog_cfg_5424 {
/* sockets only - read handler to reconnect on errors */
struct thread_master *master;
- struct thread *t_reconnect;
+ struct event *t_reconnect;
unsigned int reconn_backoff, reconn_backoff_cur, reconn_backoff_max;
int sock_type;
struct sockaddr_storage sa;