Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

Commit 21ccd49

Browse files
committed
#4 mark should_exit as volatile in the redis_subscriber example to avoid compiler optimization (which leads to infinite loop at exit)
1 parent 67c61a4 commit 21ccd49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/redis_subscriber.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <signal.h>
44
#include <iostream>
55

6-
bool should_exit = false;
6+
volatile std::atomic_bool should_exit(false);
77
cpp_redis::redis_subscriber sub;
88

99
void

0 commit comments

Comments
 (0)