diff options
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index bfee5f9235b..c65654faefb 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -607,25 +607,14 @@ int stop_slave(THD* thd, bool net_report ) // do not abort the slave in the middle of a query, so we do not set // thd->killed for the slave thread thd->proc_info = "waiting for slave to die"; - while(slave_running) + while (slave_running) { - /* there is a small chance that slave thread might miss the first - alarm. To protect againts it, resend the signal until it reacts + /* + There is a small chance that slave thread might miss the first + alarm. To protect againts it, resend the signal until it reacts */ - struct timespec abstime; -#ifdef HAVE_TIMESPEC_TS_SEC - abstime.ts_sec=time(NULL)+2; - abstime.ts_nsec=0; -#elif defined(__WIN__) - abstime.tv_sec=time((time_t*) 0)+2; - abstime.tv_nsec=0; -#else - struct timeval tv; - gettimeofday(&tv,0); - abstime.tv_sec=tv.tv_sec+2; - abstime.tv_nsec=tv.tv_usec*1000; -#endif + set_timespec(abstime, 2); pthread_cond_timedwait(&COND_slave_stopped, &LOCK_slave, &abstime); if (slave_running) KICK_SLAVE; @@ -659,8 +648,8 @@ void reset_slave() pthread_mutex_lock(&LOCK_slave); if ((slave_was_running = slave_running)) { - pthread_mutex_unlock(&LOCK_slave); - stop_slave(0,0); + pthread_mutex_unlock(&LOCK_slave); + stop_slave(0,0); } else pthread_mutex_unlock(&LOCK_slave); |