*/
while (pool->state.reconnecting) pthread_cond_wait(&pool->done_reconnecting, &pool->mutex);
- /*
- * Unlock the mutex while we try to open a new
- * connection. If there are issues with the back-end,
- * opening a new connection may take a LONG time. In
- * that case, we want the other connections to continue
- * to be used.
- */
- pthread_mutex_unlock(&pool->mutex);
-
/*
* The true value for pending_window is the smaller of
* free connection slots, or pool->pending_window.
ROPTIONAL(RDEBUG2, DEBUG2, "Opening additional connection (%" PRIu64 "), %u of %u pending slots used",
number, pool->state.pending, pending_window);
+ /*
+ * Unlock the mutex while we try to open a new
+ * connection. If there are issues with the back-end,
+ * opening a new connection may take a LONG time. In
+ * that case, we want the other connections to continue
+ * to be used.
+ */
+ pthread_mutex_unlock(&pool->mutex);
+
/*
* Allocate a new top level ctx for the create callback
* to hang its memory off of.
close_connection:
/*
* Don't close connections too often, in order to
- * prevent flapping.
+ * prevent flapping. Coverity doesn't notice that
+ * all callers have the lock, so we annotate the issue.
*/
+ /* coverity[missing_lock] */
if (fr_time_lt(now, fr_time_add(pool->state.last_spawned, pool->delay_interval))) goto manage_connections;
/*
ATEXIT_DEBUG("%s - Freeing _Thread_local destructor list %p", __FUNCTION__, list);
fr_dlist_talloc_free(&list->head); /* Free in order */
+ pthread_mutex_lock(&fr_atexit_global_mutex);
list->e->func = NULL; /* Disarm the global entry that'd free the thread-specific list */
+ pthread_mutex_unlock(&fr_atexit_global_mutex);
return 0;
}