内容摘要:复制staticboolcache_thread() { safe_mutex_assert_owner(&LOCK_thread_count)
复制static bool cache_thread() { safe_mutex_assert_owner(&LOCK_thread_count); if ( cached_thread_count <thread_cache_size && ! abort_loop && !kill_cached_threads) { /* Dont kill the thread,据库解 just put it in cache for reuse */ DBUG_PRINT("info", ("Adding thread to cache")); cached_thread_count++; while (!abort_loop && ! wake_thread && ! kill_cached_threads) (void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count); cached_thread_count--; if (kill_cached_threads) pthread_cond_signal(&COND_flush_thread_cache); if (wake_thread) { THD *thd; wake_thread--; thd= thread_cache.get(); thd->thread_stack= (char*) &thd; // For store_globals (void) thd->store_globals(); /* THD::mysys_var::abort is associated with physical thread rather than with THD object. So we need to reset this flag before using this thread for handling of new THD object/connection. */ thd->mysys_var->abort= 0; thd->thr_create_utime= my_micro_time(); threads.append(thd); return(1); } } return(0); } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.