summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-blocks/lib/message_strobe_impl.cc2
-rw-r--r--gr-blocks/lib/message_strobe_impl.h3
-rw-r--r--gr-blocks/lib/message_strobe_random_impl.h3
3 files changed, 4 insertions, 4 deletions
diff --git a/gr-blocks/lib/message_strobe_impl.cc b/gr-blocks/lib/message_strobe_impl.cc
index 094bb4348c..eb1f442874 100644
--- a/gr-blocks/lib/message_strobe_impl.cc
+++ b/gr-blocks/lib/message_strobe_impl.cc
@@ -48,8 +48,6 @@ message_strobe_impl::~message_strobe_impl() {}
bool message_strobe_impl::start()
{
- // NOTE: d_finished should be something explicitly thread safe. But since
- // nothing breaks on concurrent access, I'll just leave it as bool.
d_finished = false;
d_thread = gr::thread::thread(std::bind(&message_strobe_impl::run, this));
diff --git a/gr-blocks/lib/message_strobe_impl.h b/gr-blocks/lib/message_strobe_impl.h
index 1cb75492ea..f378054813 100644
--- a/gr-blocks/lib/message_strobe_impl.h
+++ b/gr-blocks/lib/message_strobe_impl.h
@@ -12,6 +12,7 @@
#define INCLUDED_GR_MESSAGE_STROBE_IMPL_H
#include <gnuradio/blocks/message_strobe.h>
+#include <atomic>
namespace gr {
namespace blocks {
@@ -20,7 +21,7 @@ class BLOCKS_API message_strobe_impl : public message_strobe
{
private:
gr::thread::thread d_thread;
- bool d_finished;
+ std::atomic<bool> d_finished;
long d_period_ms;
pmt::pmt_t d_msg;
const pmt::pmt_t d_port;
diff --git a/gr-blocks/lib/message_strobe_random_impl.h b/gr-blocks/lib/message_strobe_random_impl.h
index 5346c0c8ac..400ed3a2ac 100644
--- a/gr-blocks/lib/message_strobe_random_impl.h
+++ b/gr-blocks/lib/message_strobe_random_impl.h
@@ -13,6 +13,7 @@
#include <gnuradio/blocks/message_strobe_random.h>
+#include <atomic>
#include <random>
namespace gr {
@@ -29,7 +30,7 @@ private:
std::normal_distribution<> nd; //(d_mean_ms, d_std_ms);
std::uniform_real_distribution<> ud; //(d_mean_ms - d_std_ms, d_mean_ms + d_std_ms);
gr::thread::thread d_thread;
- bool d_finished;
+ std::atomic<bool> d_finished;
pmt::pmt_t d_msg;
const pmt::pmt_t d_port;