diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-10-28 17:52:54 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-10-31 14:07:04 -0400 | 
| commit | cd80fa0af40c7a3c4f17ea0d09dc53f2068099c4 (patch) | |
| tree | c49cf80432b8194ae09ddd6232d47637e1524946 | |
| parent | 2b1e5ced04bf0c8c6d8053cb798ab36ebcee9df2 (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>
| -rw-r--r-- | lib/event.c | 23 | ||||
| -rw-r--r-- | lib/frrevent.h | 2 | 
2 files changed, 0 insertions, 25 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); diff --git a/lib/frrevent.h b/lib/frrevent.h index 94640a76b7..44776b29a7 100644 --- a/lib/frrevent.h +++ b/lib/frrevent.h @@ -85,7 +85,6 @@ struct event_loop {  	int io_pipe[2];  	int fd_limit;  	struct fd_handler handler; -	unsigned long alloc;  	long selectpoll_timeout;  	bool spin;  	bool handle_signals; @@ -227,7 +226,6 @@ static inline unsigned long timeval_elapsed(struct timeval a, struct timeval b)  extern struct event_loop *event_master_create(const char *name);  void event_master_set_name(struct event_loop *master, const char *name);  extern void event_master_free(struct event_loop *m); -extern void event_master_free_unused(struct event_loop *m);  extern void _event_add_read_write(const struct xref_eventsched *xref,  				  struct event_loop *master,  | 
