From 3734e68e0b6ac1c46024424be73608be18478858 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Sun, 24 Apr 2022 10:57:19 +0800 Subject: [PATCH] sf_binlog_writer_finish check thread running --- src/sf_binlog_writer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sf_binlog_writer.c b/src/sf_binlog_writer.c index bd25949..8e767af 100644 --- a/src/sf_binlog_writer.c +++ b/src/sf_binlog_writer.c @@ -267,13 +267,17 @@ void sf_binlog_writer_finish(SFBinlogWriterInfo *writer) int count; if (writer->fw.file.name != NULL) { - while (!fc_queue_empty(&writer->thread->queue)) { + while (writer->thread->running && !fc_queue_empty( + &writer->thread->queue)) + { fc_sleep_ms(10); } - sf_binlog_writer_notify_exit(writer); + if (writer->thread->running) { + sf_binlog_writer_notify_exit(writer); + } count = 0; - while (writer->thread->running && ++count < 300) { + while (writer->thread->running && ++count < 500) { fc_sleep_ms(10); }