MCPcopy Create free account
hub / github.com/MariaDB/server / handle_manager

Function handle_manager

sql/sql_manager.cc:72–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72pthread_handler_t handle_manager(void *arg __attribute__((unused)))
73{
74 int error = 0;
75 struct timespec abstime;
76 bool reset_flush_time = TRUE;
77 my_thread_init();
78 my_thread_set_name("manager");
79 DBUG_ENTER("handle_manager");
80
81 pthread_detach_this_thread();
82 manager_thread = pthread_self();
83 mysql_mutex_lock(&LOCK_manager);
84 manager_thread_in_use = 1;
85 mysql_cond_signal(&COND_manager);
86 while (!abort_manager || cb_list)
87 {
88 /* XXX: This will need to be made more general to handle different
89 * polling needs. */
90 if (flush_time)
91 {
92 if (reset_flush_time)
93 {
94 set_timespec(abstime, flush_time);
95 reset_flush_time = FALSE;
96 }
97 while ((!error || error == EINTR) && !abort_manager && !cb_list)
98 error= mysql_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
99
100 if (error == ETIMEDOUT || error == ETIME)
101 {
102 tc_purge();
103 error = 0;
104 reset_flush_time = TRUE;
105 }
106 }
107 else
108 {
109 while ((!error || error == EINTR) && !abort_manager && !cb_list)
110 error= mysql_cond_wait(&COND_manager, &LOCK_manager);
111 }
112
113 struct handler_cb *cb= cb_list;
114 cb_list= NULL;
115 mysql_mutex_unlock(&LOCK_manager);
116
117 while (cb)
118 {
119 struct handler_cb *next= cb->next;
120 cb->action(cb->data);
121 my_free(cb);
122 cb= next;
123 }
124 mysql_mutex_lock(&LOCK_manager);
125 }
126 DBUG_ASSERT(cb_list == NULL);
127 manager_thread_in_use = 2;
128 mysql_mutex_unlock(&LOCK_manager);
129 mysql_mutex_destroy(&LOCK_manager);

Callers

nothing calls this directly

Calls 5

my_thread_initFunction · 0.85
my_thread_set_nameFunction · 0.85
tc_purgeFunction · 0.85
my_freeFunction · 0.85
my_thread_endFunction · 0.85

Tested by

no test coverage detected