File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ std::atomic<bool> terminated(FALSE);
3232std::condition_variable cv;
3333std::mutex cv_mutex;
3434
35+ std::condition_variable duration_cv;
36+ std::mutex duration_cv_mutex;
37+
3538typedef enum _StreamSource {
3639 TEST_SOURCE,
3740 DEVICE_SOURCE
@@ -47,6 +50,7 @@ typedef struct _CustomData {
4750} CustomData;
4851
4952void shutdown_sample () {
53+ LOG_INFO (" [KVS sample] Shutting down sample..." );
5054 std::lock_guard<std::mutex> lock (cv_mutex);
5155 terminated = TRUE ;
5256 cv.notify_all ();
@@ -367,8 +371,8 @@ int main(int argc, char *argv[]) {
367371 // Start the timer thread to terminate the sample after a specified duration.
368372 std::thread timerThread ([runtime_duration_seconds]() {
369373 LOG_INFO (" [KVS sample] Timer thread started. Will wait for " << runtime_duration_seconds << " seconds or until terminated." );
370- std::unique_lock<std::mutex> lck (cv_mutex );
371- if (cv .wait_for (lck, std::chrono::seconds (runtime_duration_seconds)) == std::cv_status::timeout) {
374+ std::unique_lock<std::mutex> lck (duration_cv_mutex );
375+ if (duration_cv .wait_for (lck, std::chrono::seconds (runtime_duration_seconds)) == std::cv_status::timeout) {
372376 if (!terminated) {
373377 LOG_INFO (" [KVS sample] Reached maximum runtime of " << runtime_duration_seconds << " seconds. Terminating." );
374378 shutdown_sample ();
You can’t perform that action at this time.
0 commit comments