| 215 | } |
| 216 | |
| 217 | struct 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 | |
| 243 | static int get_timeout_sql_pool_func(void *obj, void *arg) |
| 244 | { |
no test coverage detected