GRAS flow control from work function

Hi,

I’m using gras for my application and my custom block needs to be able
to do a blocking read to get data from an external source. With the
standard scheduler I used a non blocking read in a polling loop with an
interruptable sleep and this worked Ok. Do I need to do it this way with
gras or can I get away with with blocking?

Another thing my block must do is stop the flow graph if its external
source has signaled that it is done. I did this with the standard
scheduler by returning WORK_DONE. How should this be done with gras?

Thanks.

On 07/15/2013 05:43 PM, [email protected] wrote:

Hi,

I’m using gras for my application and my custom block needs to be
able to do a blocking read to get data from an external source. With
the standard scheduler I used a non blocking read in a polling loop
with an interruptable sleep and this worked Ok. Do I need to do it
this way with gras or can I get away with with blocking?

Basically, you want to avoid stealing away the work() thread for too
long. So I recommend polling with a small timeout and return if there is
nothing. Work will get called again.

Relevant discussion:
http://lists.gnu.org/archive/html/discuss-gnuradio/2013-05/msg00124.html

Another thing my block must do is stop the flow graph if its external
source has signaled that it is done. I did this with the standard
scheduler by returning WORK_DONE. How should this be done with gras?

Use this->mark_done()

-josh