/* If a thread was created to handle this connection: increment slow_launch_threads counter if it took more than slow_launch_time seconds to create the thread. */ if (thd->prior_thr_create_utime) { ulong launch_time= (ulong) (thd->thr_create_utime - thd->prior_thr_create_utime); if (launch_time >= slow_launch_time*1000000L) statistic_increment(slow_launch_threads, &LOCK_status); thd->prior_thr_create_utime= 0; }
/* handle_one_connection() is normally the only way a thread would start and would always be on the very high end of the stack , therefore, the thread stack always starts at the address of the first local variable of handle_one_connection, which is thd. We need to know the start of the stack so that we could check for stack overruns. */ thd->thread_stack= (char*) &thd; if (setup_connection_thread_globals(thd)) return;
/* If end_thread() returns, we are either running with thread-handler=no-threads or this thread has been schedule to handle the next connection. */ thd= current_thd; thd->thread_stack= (char*) &thd; } }