bool servers_init(bool dont_read_servers_table) { THD *thd; bool return_val= FALSE; DBUG_ENTER("servers_init"); /* init the mutex */ if (my_rwlock_init(&THR_LOCK_servers, NULL)) DBUG_RETURN(TRUE); /* initialise our servers cache */ if (hash_init(&servers_cache, system_charset_info, 32, 0, 0, (hash_get_key) servers_cache_get_key, 0, 0)) { return_val= TRUE; /* we failed, out of memory? */ goto end; } /* Initialize the mem root for data */ init_alloc_root(&mem, ACL_ALLOC_BLOCK_SIZE, 0); if (dont_read_servers_table) goto end; /* To be able to run this from boot, we allocate a temporary THD */ if (!(thd=new THD)) DBUG_RETURN(TRUE); thd->thread_stack= (char*) &thd; thd->store_globals(); lex_start(thd); /* It is safe to call servers_reload() since servers_* arrays and hashes which will be freed there are global static objects and thus are initialized by zeros at startup. */ return_val= servers_reload(thd); delete thd; /* Remember that we don't have a THD */ my_pthread_setspecific_ptr(THR_THD, 0); end: DBUG_RETURN(return_val); }
static void rc_rwlock_init(WT_RESOURCE *rc) { my_rwlock_init(&rc->lock, 0); }