| 1182 | |
| 1183 | |
| 1184 | void clean_up(bool print_message) |
| 1185 | { |
| 1186 | DBUG_PRINT("exit",("clean_up")); |
| 1187 | if (cleanup_done++) |
| 1188 | return; /* purecov: inspected */ |
| 1189 | |
| 1190 | logger.cleanup_base(); |
| 1191 | |
| 1192 | my_dboptions_cache_free(); |
| 1193 | ignore_db_dirs_free(); |
| 1194 | item_func_sleep_free(); |
| 1195 | lex_free(); /* Free some memory */ |
| 1196 | item_create_cleanup(); |
| 1197 | end_thr_alarm(1); /* Free allocated memory */ |
| 1198 | my_free_open_file_info(); |
| 1199 | if (defaults_argv) |
| 1200 | free_defaults(defaults_argv); |
| 1201 | free_tmpdir(&mysql_tmpdir_list); |
| 1202 | my_free(opt_bin_logname); |
| 1203 | bitmap_free(&temp_pool); |
| 1204 | |
| 1205 | my_regex_end(); |
| 1206 | |
| 1207 | cleanup_errmsgs(); |
| 1208 | (void) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); // finish server errs |
| 1209 | DBUG_PRINT("quit", ("Error messages freed")); |
| 1210 | /* Tell main we are ready */ |
| 1211 | logger.cleanup_end(); |
| 1212 | my_atomic_rwlock_destroy(&opt_binlog_max_flush_queue_time_lock); |
| 1213 | my_atomic_rwlock_destroy(&global_query_id_lock); |
| 1214 | my_atomic_rwlock_destroy(&thread_running_lock); |
| 1215 | free_charsets(); |
| 1216 | mysql_mutex_lock(&LOCK_thread_count); |
| 1217 | DBUG_PRINT("quit", ("got thread count lock")); |
| 1218 | ready_to_exit=1; |
| 1219 | /* do the broadcast inside the lock to ensure that my_end() is not called */ |
| 1220 | mysql_cond_broadcast(&COND_thread_count); |
| 1221 | mysql_mutex_unlock(&LOCK_thread_count); |
| 1222 | delete_global_thread_list(); |
| 1223 | |
| 1224 | if (THR_THD) |
| 1225 | (void) pthread_key_delete(THR_THD); |
| 1226 | |
| 1227 | if (THR_MALLOC) |
| 1228 | (void) pthread_key_delete(THR_MALLOC); |
| 1229 | |
| 1230 | my_handle_options_end(); |
| 1231 | |
| 1232 | /* |
| 1233 | The following lines may never be executed as the main thread may have |
| 1234 | killed us |
| 1235 | */ |
| 1236 | DBUG_PRINT("quit", ("done with cleanup")); |
| 1237 | } /* clean_up */ |
| 1238 | |
| 1239 | |
| 1240 | #ifndef EMBEDDED_LIBRARY |
no test coverage detected