Forum: GNU Radio Block continues after EOF

Posted by Martin Luelf (Guest)
on 2013-02-20 00:57
(Received via mailing list)
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
Posted by Martin Luelf (Guest)
on 2013-02-20 10:23
(Received via mailing list)
>
>
> work function called
> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.