Hello

My name is Isaac . I'm trying to do a message strobe OOT block which could
read a .txt file to define a list of command messages. I created a general
block and deleted the general_work class as messages work in a separate
thread.

I literally write the same idea of the message strobe block provided by GNU
Radio for the use of the thread:

bool
    thread_ptr_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 = boost::shared_ptr<gr::thread::thread>
        (new gr::thread::thread(boost::bind(&thread_ptr_impl::run, this)));
      return block::start();
    }

void thread_ptr_impl::run()
    {
      while(!d_finished) {

boost::this_thread::sleep(boost::posix_time::milliseconds(static_cast<long>(d_period_ms)));
        if(d_finished) {
          return;
        }
        message_port_pub(d_port, d_msg);
      }
    }

My problem is that when GNU Radio finishes to wait in the run() function
(boost::this_thread::sleep) , instead of continuing with the conditional
"if", it finishes the programme and it doesn't achieve publish the message.

¿What could be happening here? ¿Why is this happening here and doesn't
happen in the GNU Radio message strobe? ¿Maybe a configuration in the CMake
or I have to choose a non-general OOT block?

I really appreciate any idea or suggestion.
Thanks
Isaac T.

Reply via email to