25 #include "sql_manager.h"
29 static bool volatile manager_thread_in_use;
30 static bool abort_manager;
32 pthread_t manager_thread;
43 bool mysql_manager_submit(
void (*action)())
49 while (*cb && (*cb)->action != action)
59 (*cb)->action= action;
66 pthread_handler_t handle_manager(
void *arg __attribute__((unused)))
70 bool reset_flush_time = TRUE;
73 DBUG_ENTER(
"handle_manager");
75 pthread_detach_this_thread();
76 manager_thread = pthread_self();
77 manager_thread_in_use = 1;
88 set_timespec(abstime, flush_time);
89 reset_flush_time = FALSE;
91 while ((!error || error == EINTR) && !abort_manager)
96 while ((!error || error == EINTR) && !abort_manager)
109 if (error == ETIMEDOUT || error == ETIME)
111 tdc_flush_unused_tables();
113 reset_flush_time = TRUE;
124 manager_thread_in_use = 0;
132 void start_handle_manager()
134 DBUG_ENTER(
"start_handle_manager");
135 abort_manager =
false;
136 if (flush_time && flush_time != ~(ulong) 0L)
141 &hThread, &connection_attrib,
143 sql_print_warning(
"Can't create handle_manager thread (errno= %d)",
151 void stop_handle_manager()
153 DBUG_ENTER(
"stop_handle_manager");
154 abort_manager =
true;
156 if (manager_thread_in_use)
158 DBUG_PRINT(
"quit", (
"initiate shutdown of handle manager thread: 0x%lx",
159 (ulong)manager_thread));