MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / get_named_sql_pool

Function get_named_sql_pool

db/sqlpool.c:217–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217struct thdpool *get_named_sql_pool(const char *zName, int bCreate, int nThreads)
218{
219 if ((zName != NULL) && strcasecmp(zName, SQL_POOL_DEFLT_NAME)) {
220 struct thdpool *pool = NULL;
221 Pthread_mutex_lock(&sqlengine_pool_mutex);
222 if (sqlengine_pool_hash != NULL) {
223 pool_entry_t *entry = hash_find(sqlengine_pool_hash, &zName);
224 if (entry != NULL) {
225 pool = entry->pPool;
226 } else if (bCreate) {
227 pool = create_sql_pool(zName, nThreads);
228 if (pool != NULL) {
229 if (try_add_sql_pool(zName, nThreads, pool) != 0) {
230 thdpool_destroy(&pool, SQL_POOL_STOP_TIMEOUT_US);
231 pool = NULL;
232 }
233 }
234 }
235 }
236 Pthread_mutex_unlock(&sqlengine_pool_mutex);
237 return pool;
238 } else {
239 return get_default_sql_pool(bCreate);
240 }
241}
242
243static int get_timeout_sql_pool_func(void *obj, void *arg)
244{

Callers 2

comdb2_load_rulesetFunction · 0.85

Calls 5

hash_findFunction · 0.85
create_sql_poolFunction · 0.85
try_add_sql_poolFunction · 0.85
thdpool_destroyFunction · 0.85
get_default_sql_poolFunction · 0.85

Tested by

no test coverage detected