summaryrefslogtreecommitdiffstats
path: root/lib/frrevent.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
commitacb594b1d825c6e12369cebb941968ec08c840ce (patch)
treed544788908e7353a4f117e2991f15f4236a0c963 /lib/frrevent.h
parentAdding upstream version 9.1. (diff)
downloadfrr-acb594b1d825c6e12369cebb941968ec08c840ce.tar.xz
frr-acb594b1d825c6e12369cebb941968ec08c840ce.zip
Adding upstream version 10.0.upstream/10.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/frrevent.h')
-rw-r--r--lib/frrevent.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/frrevent.h b/lib/frrevent.h
index 3f74df3..94640a7 100644
--- a/lib/frrevent.h
+++ b/lib/frrevent.h
@@ -6,6 +6,7 @@
#ifndef _ZEBRA_THREAD_H
#define _ZEBRA_THREAD_H
+#include <signal.h>
#include <zebra.h>
#include <pthread.h>
#include <poll.h>
@@ -91,6 +92,8 @@ struct event_loop {
pthread_mutex_t mtx;
pthread_t owner;
+ nfds_t last_read;
+
bool ready_run_loop;
RUSAGE_T last_getrusage;
};
@@ -153,6 +156,12 @@ struct cpu_event_history {
/* Struct timeval's tv_usec one second value. */
#define TIMER_SECOND_MICRO 1000000L
+static inline unsigned long timeval_elapsed(struct timeval a, struct timeval b)
+{
+ return (((a.tv_sec - b.tv_sec) * TIMER_SECOND_MICRO)
+ + (a.tv_usec - b.tv_usec));
+}
+
/* Event yield time. */
#define EVENT_YIELD_TIME_SLOT 10 * 1000L /* 10ms */