[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Block continues after EOF
From: |
Martin Luelf |
Subject: |
Re: [Discuss-gnuradio] Block continues after EOF |
Date: |
Wed, 20 Feb 2013 10:22:25 +0100 |
User-agent: |
SquirrelMail/1.4.22 |
> Dear List,
>
> I have another problem with stopping my C++ block. My block receives blobs
> of bytes as messages over the new message passing interface and outputs
> them as a byte stream. At some place I receive an EOF message, set a flag
> and continue to empty my buffer in the work method. Once the buffer is
> empty I signal EOF to the flowgraph by returning -1 from general_work.
> However after that my work function keeps getting called.
>
> My general_work function looks like this:
>
> int general_work(int noutput_items, gr_vector_int& ninput_items,
> gr_vector_const_void_star& input_items, gr_vector_void_star& output_items)
> {
> printf("work function called\n");
>
> if(d_stop && d_queue.size() == 0) {
> // signal EOF
> printf("Signal EOF\n");
> return -1;
> }
>
> int num_out;
> // Generate the actual output
> // ...
>
> return num_out;
> }
>
> And the output I get looks like this:
> work function called
> work function called
> work function called
> Signal EOF
> work function called
> work function called
> work function called
> work function called
> ...
> Until I stop the whole flowgraph with Ctrl+C
>
> What am I missing here? If I understood correctly the work function should
> not be called anymore after signalling EOF, since there is by definition
> of EOF, nothing more to get.
>
> Yours
> Martin
Oh boy, starting again with a clear head this morning I found my mistake
almost immediately. In fact I had another instance of the same block
running, so the output I posted was actually from two blocks from which
one exited as expected, the other one kept running.
Sorry for the false alarm,
Martin