From 5d52f71258910df152c20b3256786806db7223cb Mon Sep 17 00:00:00 2001 From: xufuji456 Date: Mon, 19 Sep 2022 15:04:46 +0800 Subject: [PATCH] Feature: when not running, return anyway --- Live/src/main/cpp/safe_queue.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Live/src/main/cpp/safe_queue.h b/Live/src/main/cpp/safe_queue.h index 49a2615..ed90570 100644 --- a/Live/src/main/cpp/safe_queue.h +++ b/Live/src/main/cpp/safe_queue.h @@ -62,7 +62,9 @@ public: int ret = 0; #ifdef C11 unique_lock lk(mt); - cv.wait(lk,[this]{return !work || !q.empty();}); + if (!work) { + return ret; + } if (!q.empty()) { value = q.front(); q.pop();