Apologies if this has been sent multiple times; I've been having issues with my mailing list subscription.
I am trying to implement a relatively simple block that acts as a message-enabled timed gate. The block has one stream input, one stream output, and one input message port for control. The block diagram is shown here: ################# ############# # Signal source # ====> # Enable # ====> [OUTPUT] ################# # Timed # MSG ----> # Burst # ############# I want the block to output an all-zero stream until it receives the message, at which point it should output whatever samples are being sent in for a fixed number of samples. For some reason though, whenever the block receives a message, the work function is no longer called. None of the debug messages in the work function are printed to console, and I do not see any more samples being outputted from the block. However, the message-reception block ("on_enable") continues to be called every time a new message comes in. I couldn't find any mention of this happening before on the mailing list or forums. If anyone can shed any light on why this is happening or can give any advice as to a better way to implement this, it would be really appreciated. The relevant components of my code are below: /* The private constructor */ enable_timed_burst_impl::enable_timed_burst_impl(bool debug, int burst_length) : gr::sync_block("enable_timed_burst", gr::io_signature::make(1, 1, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex))), d_debug(debug), d_burst_length(burst_length), enable_msg_in_port_name(pmt::mp("enable_msg_in")) { // Set enable status to false enable_burst = false; //sample_counter = 0; // Prepare control message port message_port_register_in(enable_msg_in_port_name); set_msg_handler(enable_msg_in_port_name, boost::bind(&enable_timed_burst_impl::on_enable, this, _1)); } /* On "enable" message */ void enable_timed_burst_impl::on_enable(pmt::pmt_t msg) { // Set enable status to true enable_burst = true; debug_out("Burst enabled."); return; } /* Work */ int enable_timed_burst_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { debug_out("Work called."); // Input and output streams const gr_complex *in = (const gr_complex *)input_items[0]; gr_complex *out = (gr_complex *)output_items[0]; // Number of output and input items is always the burst length noutput_items = d_burst_length; // If burst enabled, pass the output; otherwise, pass zeroes if (enable_burst) { debug_out("I reached here!"); for (int ticker = 0; ticker < d_burst_length; ticker++) out[ticker] = in[ticker]; enable_burst = false; debug_out("Burst disabled."); } else { for (int ticker = 0; ticker < d_burst_length; ticker++) out[ticker] = 0; debug_out("Nothing..."); } // Tell runtime system how many output items we produced. return noutput_items; } Thanks, Alon