summaryrefslogtreecommitdiff
path: root/lib/event.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-10-28 17:52:54 -0400
committerDonald Sharp <sharpd@nvidia.com>2024-10-31 14:07:04 -0400
commitcd80fa0af40c7a3c4f17ea0d09dc53f2068099c4 (patch)
treec49cf80432b8194ae09ddd6232d47637e1524946 /lib/event.c
parent2b1e5ced04bf0c8c6d8053cb798ab36ebcee9df2 (diff)
lib: Remove counter and a function
The `alloc` counter was tracking the current active number of events in the system and if it went to 0 when freeing a new one it would assert. This assert is a duplicate of what would happen with the XFREE in the same situation. As such it is not necessary. Also remove the `event_master_free_unused` function from the system. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/event.c')
-rw-r--r--lib/event.c23
1 files changed, 0 insertions, 23 deletions
diff --git a/lib/event.c b/lib/event.c
index c573923f51..cfe8c3adc0 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -669,24 +669,6 @@ static void thread_array_free(struct event_loop *m, struct event **thread_array)
XFREE(MTYPE_EVENT_POLL, thread_array);
}
-/*
- * event_master_free_unused
- *
- * As threads are finished with they are put on the
- * unuse list for later reuse.
- * If we are shutting down, Free up unused threads
- * So we can see if we forget to shut anything off
- */
-void event_master_free_unused(struct event_loop *m)
-{
- frr_with_mutex (&m->mtx) {
- struct event *t;
-
- while ((t = event_list_pop(&m->unuse)))
- thread_free(m, t);
- }
-}
-
/* Stop thread scheduler. */
void event_master_free(struct event_loop *m)
{
@@ -793,7 +775,6 @@ static struct event *thread_get(struct event_loop *m, uint8_t type,
thread = XCALLOC(MTYPE_THREAD, sizeof(struct event));
/* mutex only needs to be initialized at struct creation. */
pthread_mutex_init(&thread->mtx, NULL);
- m->alloc++;
}
thread->type = type;
@@ -832,10 +813,6 @@ static struct event *thread_get(struct event_loop *m, uint8_t type,
static void thread_free(struct event_loop *master, struct event *thread)
{
- /* Update statistics. */
- assert(master->alloc > 0);
- master->alloc--;
-
/* Free allocated resources. */
pthread_mutex_destroy(&thread->mtx);
XFREE(MTYPE_THREAD, thread);