MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / wait_server_to_start

Function wait_server_to_start

handlersocket/database.cpp:236–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234namespace {
235
236int
237wait_server_to_start(THD *thd, volatile int& shutdown_flag)
238{
239 int r = 0;
240 DBG_SHUT(fprintf(stderr, "HNDSOCK wsts\n"));
241 pthread_mutex_lock(&LOCK_server_started);
242 while (!mysqld_server_started) {
243 timespec abstime = { };
244 set_timespec(abstime, 1);
245 pthread_cond_timedwait(&COND_server_started, &LOCK_server_started,
246 &abstime);
247 pthread_mutex_unlock(&LOCK_server_started);
248 pthread_mutex_lock(&thd->mysys_var->mutex);
249 int killed = thd_killed(thd);
250 pthread_mutex_unlock(&thd->mysys_var->mutex);
251 DBG_SHUT(fprintf(stderr, "HNDSOCK wsts kst %d\n", killed));
252 pthread_mutex_lock(&LOCK_server_started);
253 if (killed) {
254 DBG_SHUT(fprintf(stderr, "HNDSOCK wsts kst %d break\n", killed));
255 r = -1;
256 break;
257 }
258 if (shutdown_flag) {
259 DBG_SHUT(fprintf(stderr, "HNDSOCK wsts kst shut break\n"));
260 r = -1;
261 break;
262 }
263 }
264 pthread_mutex_unlock(&LOCK_server_started);
265 DBG_SHUT(fprintf(stderr, "HNDSOCK wsts done\n"));
266 return r;
267}
268
269}; // namespace
270

Callers 1

init_threadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected