From 3ec469c2f316f61db5757985205058350e288418 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 23 May 2024 12:17:09 -0400 Subject: [PATCH] lib: Thread is being used and set at the same time The call to set thread is being used and set at the same time in various pthreads in the code. This should not be happening. Let's fix it. Signed-off-by: Donald Sharp --- lib/event.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/event.c b/lib/event.c index fc46a11c0b46..d1b9e98b8184 100644 --- a/lib/event.c +++ b/lib/event.c @@ -1531,13 +1531,7 @@ void event_cancel_async(struct event_loop *master, struct event **thread, { assert(!(thread && eventobj) && (thread || eventobj)); - if (thread && *thread) - frrtrace(9, frr_libfrr, event_cancel_async, master, - (*thread)->xref->funcname, (*thread)->xref->xref.file, - (*thread)->xref->xref.line, NULL, (*thread)->u.fd, - (*thread)->u.val, (*thread)->arg, - (*thread)->u.sands.tv_sec); - else + if (!thread) frrtrace(9, frr_libfrr, event_cancel_async, master, NULL, NULL, 0, NULL, 0, 0, eventobj, 0); @@ -1547,6 +1541,14 @@ void event_cancel_async(struct event_loop *master, struct event **thread, master->canceled = false; if (thread) { + if (*thread) + frrtrace(9, frr_libfrr, event_cancel_async, + master, (*thread)->xref->funcname, + (*thread)->xref->xref.file, + (*thread)->xref->xref.line, NULL, + (*thread)->u.fd, (*thread)->u.val, + (*thread)->arg, + (*thread)->u.sands.tv_sec); struct cancel_req *cr = XCALLOC(MTYPE_TMP, sizeof(struct cancel_req)); cr->threadref = thread;