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