From a570e37c067fc83e5d78698a118e8c8e45085498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 4 Jun 2026 11:58:12 +0200 Subject: [PATCH] Only update the global tid_count once Normally, the tid_count is initialized only once at the beginning of the application. The only exception is the pattern in the unit test where isc_loopmgr is repeatedly created and torn down and each creation of isc_loopmgr_t calls isc__tid_initcount() with the previous value. ThreadSanitizer sees that as write operation on unprotected memory are reports this as data race even though the value has not really changed. This has been fixed by skipping the tid_count value update on repeated calls. --- lib/isc/tid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/isc/tid.c b/lib/isc/tid.c index ce385abeb7..9550908a22 100644 --- a/lib/isc/tid.c +++ b/lib/isc/tid.c @@ -11,7 +11,6 @@ * information regarding copyright ownership. */ -#include #include #include @@ -45,7 +44,9 @@ void isc__tid_initcount(isc_tid_t count) { REQUIRE(tid_count == 0 || tid_count == count); REQUIRE(count < ISC_TID_MAX); - tid_count = count; + if (tid_count == 0) { + tid_count = count; + } } /**