Start the slave deadlock handler thread. This thread is used to kill worker thread transactions during parallel replication, when a storage engine attempts to take an errorneous conflicting lock that would cause a deadlock. Killing is done asynchroneously, as the kill may not be safe within the context of a callback from inside storage engine locking code. */
| 540 | callback from inside storage engine locking code. |
| 541 | */ |
| 542 | static int |
| 543 | start_slave_deadlock_handler_thread() |
| 544 | { |
| 545 | pthread_t th; |
| 546 | |
| 547 | mysql_mutex_lock(&LOCK_slave_deadlock_handler); |
| 548 | slave_deadlock_handler_thread_running= false; |
| 549 | slave_deadlock_handler_thread_stop= false; |
| 550 | if (mysql_thread_create(key_thread_slave_deadlock_handler, |
| 551 | &th, &connection_attrib, slave_deadlock_handler, |
| 552 | NULL)) |
| 553 | { |
| 554 | sql_print_error("Failed to create thread while initialising slave"); |
| 555 | return 1; |
| 556 | } |
| 557 | |
| 558 | while (!slave_deadlock_handler_thread_running) |
| 559 | mysql_cond_wait(&COND_slave_deadlock_handler, &LOCK_slave_deadlock_handler); |
| 560 | mysql_mutex_unlock(&LOCK_slave_deadlock_handler); |
| 561 | |
| 562 | return 0; |
| 563 | } |
| 564 | |
| 565 | |
| 566 | static void |
no test coverage detected