| 770 | } |
| 771 | |
| 772 | void remove_global_thread(THD *thd) |
| 773 | { |
| 774 | DBUG_PRINT("info", ("remove_global_thread %p", |
| 775 | thd)); |
| 776 | mysql_mutex_lock(&LOCK_thd_remove); |
| 777 | mysql_mutex_lock(&LOCK_thread_count); |
| 778 | DBUG_ASSERT(thd->release_resources_done()); |
| 779 | /* |
| 780 | Used by binlog_reset_master. It would be cleaner to use |
| 781 | DEBUG_SYNC here, but that's not possible because the THD's debug |
| 782 | sync feature has been shut down at this point. |
| 783 | */ |
| 784 | DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", |
| 785 | sleep(5);); |
| 786 | |
| 787 | const size_t num_erased= global_thread_list->erase(thd); |
| 788 | if (num_erased == 1) |
| 789 | --global_thread_count; |
| 790 | // Removing a THD that was never added is an error. |
| 791 | DBUG_ASSERT(1 == num_erased); |
| 792 | |
| 793 | mysql_mutex_unlock(&LOCK_thd_remove); |
| 794 | mysql_cond_broadcast(&COND_thread_count); |
| 795 | mysql_mutex_unlock(&LOCK_thread_count); |
| 796 | } |
| 797 | |
| 798 | uint get_thread_count() |
| 799 | { |
nothing calls this directly
no test coverage detected