Hi Michael, Thanks for you support but I'm still getting the same error. :/
1) Yes, I'm already doing that. 2) I did that. See figure bellow. Unfortunately, the error persists as you can see bellow. *Figure 1: *start() method. ** *Figure 2:* error I have not found such examples you mentioned for part two. Only few poor/ not crystal clear references about how to do this. Would you have any other suggestions? Kind regards, *André Gomes* Email: andre.go...@dcc.ufmg.br Homepage: http://homepages.dcc.ufmg.br/~andre.gomes/ Mobile: +55 31 994859285 <+55%2031%2099485-9285> On 12 November 2017 at 18:17, Michael Dickens <michael.dick...@ettus.com> wrote: > Hi André - I think you're looking for 2 steps: > > 1) In the block constructor, declare the message port, e.g.: > {{{ > message_port_register_out (pmt::mp ("frame request")); > }}} > You're probably already doing this. > > 2) Add the thread creation to the ::start method, so that the thread is > not trying to do something before the output message port is actually > active. Make sure to use gr::thread::thread and boost::bind such that the > thread is running in the same class namespace as the rest of the block, > to get access to its variables and methods. > > The GR codebase provides examples of how to do this 2-part thread creation > approach. Hope this helps! - MLD > > On Sun, Nov 12, 2017, at 03:01 PM, André Gomes wrote: > > I'm getting an error while trying to use an output message port with a > thread. The thread is responsible for executing function *check_buff()*. > It seems to return the error bellow because the message port inside the > function was not initialized yet. Firstly, the thread was started at the > constructor. According to this link > <https://lists.gnu.org/archive/html/discuss-gnuradio/2016-02/msg00388.html>, > starting at the constructor is the root of the problem and one should start > the thread in the start function of the block (bool start()). So I did but > I'm still getting the same error. The port still does not exist when the > thread starts. > How do I guarantee the existence of the port before starting the thread? > > *Figure 1: *Error > [image: Inline images 2] > > *Figure 2: *Function used by thread. > [image: Inline images 1] > > >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio