*managerp = NULL;
}
+/*
+ * ISC_QUEUE_POP is deliberately not tsan safe to avoid aquiring
+ * the taillock every time ISC_QUEUE_POP is called.
+ * Isolate ISC_QUEUE_POP from tsan analysis.
+ */
+ISC_NO_SANITIZE_THREAD static ns_client_t *
+queue_pop(ns_clientmgr_t *manager)
+{
+ ns_client_t *client = NULL;
+
+ if (!ns_g_clienttest) {
+ ISC_QUEUE_POP(manager->inactive, ilink, client);
+ }
+ return (client);
+}
+
static isc_result_t
get_client(ns_clientmgr_t *manager, ns_interface_t *ifp,
dns_dispatch_t *disp, bool tcp)
* if that fails, make a new one.
*/
client = NULL;
- if (!ns_g_clienttest)
- ISC_QUEUE_POP(manager->inactive, ilink, client);
+ if (!ns_g_clienttest) {
+ client = queue_pop(manager);
+ }
if (client != NULL)
MTRACE("recycle");
* if that fails, make a new one.
*/
client = NULL;
- if (!ns_g_clienttest)
- ISC_QUEUE_POP(manager->inactive, ilink, client);
+ if (!ns_g_clienttest) {
+ client = queue_pop(manager);
+ }
if (client != NULL)
MTRACE("recycle");
#define __SANITIZE_ADDRESS__ 1
#endif
+/* GCC defines __SANITIZE_THREAD__, so reuse the macro for clang */
+#if __has_feature(thread_sanitizer)
+#define __SANITIZE_THREAD__ 1
+#endif
+
+#if __SANITIZE_THREAD__
+#define ISC_NO_SANITIZE_THREAD __attribute__((no_sanitize("thread")))
+#else /* if __SANITIZE_THREAD__ */
+#define ISC_NO_SANITIZE_THREAD
+#endif /* if __SANITIZE_THREAD__ */
+
#ifdef UNIT_TESTING
extern void mock_assert(const int result, const char* const expression,
const char * const file, const int line);