Quantcast

Reg : start() method in gr_top_block.h

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Reg : start() method in gr_top_block.h

sumitstop
Q-1

In the gr_top_block.h the start function has been defined as follows :

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void start(int max_noutput_items=100000);

  /*!
   * Stop the running flowgraph.  Notifies each thread created by the
   * scheduler to shutdown, then returns to caller. Calling stop() on
   * a top_block that is already stopped IS NOT an error.
   */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I am getting confused because its saying that it "Stop the running flow graph ........... Notifies each thread created by the scheduler to shutdown ................ then returns to caller" So what does start means here.

Q-2

Also its mentioned that run() method has maximum number of outputs is 1000000 but I was able to collect 2000000 samples using uhd_rx_cfile with the tb.run() method ? Where I am wrong ??








Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reg : start() method in gr_top_block.h

Josh Blum-3


On 10/08/2012 04:12 PM, sumitstop wrote:

> Q-1
>
> In the gr_top_block.h the start function has been defined as follows :
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> void start(int max_noutput_items=100000);
>
>   /*!
>    * Stop the running flowgraph.  Notifies each thread created by the
>    * scheduler to shutdown, then returns to caller. Calling stop() on
>    * a top_block that is already stopped IS NOT an error.
>    */
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> I am getting confused because its saying that it "Stop the running flow
> graph ........... Notifies each thread created by the scheduler to shutdown
> ................ then returns to caller" So what does start means here.
>

start() -> spawns threads, begins flow graph execution
stop() -> non blocking, interrupts threads, see boost thread interrupts
wait() -> blocking join of threads, ie waits for completion

run is a convenience call for finite flowgraph processing. run() means
start() + wait(). There is no stop because the flowgraph should shut
itself down by use of blocks like gr.head(). Essentially, this is for
testing purposes almost exclusively.

> Q-2
>
> Also its mentioned that run() method has maximum number of outputs is
> 1000000 but I was able to collect 2000000 samples using uhd_rx_cfile with
> the tb.run() method ? Where I am wrong ??
>

start/run with the number of items parameter are just convenience calls
to set the max buffer size + start/run the flow graph.

Thats an internal buffer size limit. It shouldn't effect the functional
correctness of a flowgraph.

-josh

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reg : start() method in gr_top_block.h

sumitstop
Got it perfectly  

**Just observed that in uhd_rx_cfile tb.run() has been used.
When we leave the number of samples blank i.e. infinity the  script keeps collecting data because of tb.run() but when we choose the no of samples option, a separate gr.head is block is created with specified no of samples and it stops after collecting the same.  
Loading...