| 2912 | }; |
| 2913 | |
| 2914 | static const char *thread_state_info(THD *tmp) |
| 2915 | { |
| 2916 | #ifndef EMBEDDED_LIBRARY |
| 2917 | if (tmp->net.reading_or_writing) |
| 2918 | { |
| 2919 | if (tmp->net.reading_or_writing == 2) |
| 2920 | return "Writing to net"; |
| 2921 | if (tmp->get_command() == COM_SLEEP) |
| 2922 | return ""; |
| 2923 | return "Reading from net"; |
| 2924 | } |
| 2925 | #else |
| 2926 | if (tmp->get_command() == COM_SLEEP) |
| 2927 | return ""; |
| 2928 | #endif |
| 2929 | |
| 2930 | if (tmp->proc_info) |
| 2931 | return tmp->proc_info; |
| 2932 | |
| 2933 | /* Check if we are waiting on a condition */ |
| 2934 | if (!trylock_short(&tmp->LOCK_thd_kill)) |
| 2935 | { |
| 2936 | /* mysys_var is protected by above mutex */ |
| 2937 | bool cond= tmp->mysys_var && tmp->mysys_var->current_cond; |
| 2938 | mysql_mutex_unlock(&tmp->LOCK_thd_kill); |
| 2939 | if (cond) |
| 2940 | return "Waiting on cond"; |
| 2941 | } |
| 2942 | return ""; |
| 2943 | } |
| 2944 | |
| 2945 | |
| 2946 | /* |
no test coverage detected