Hi

I used a blank work() function as follows

def work(self,ins,outs):
 print " i m in work "
self.mark_done()

using "mark_done(), I got the control back in the main loop.

When I use my specific work() function with  mark_done() after a successful
event, I get following error message:

ASSERT FAIL
/usr/local/software/gnuradio-3.6.4.2/gras/lib/gras_impl/output_buffer_queues.hpp:60
not this->empty(i)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gras/GRAS_PyBlock.py", line
230, in _Py_work
    ret = self.work(input_arrays, output_arrays)
  File "/usr/local/software/working_TRANS_19/new_split_tx.py", line 304, in
work

self.send_pkt_phy(self.outgoing_msg,self.arq_expected_sequence_no,self.h,DATA_PKT)
  File "/usr/local/software/working_TRANS_19/new_split_tx.py", line 324, in
send_pkt_phy
    buff = self.get_output_buffer(PHY_PORT)
  File "/usr/local/lib/python2.7/dist-packages/gras/GRAS_Block.py", line
231, in get_output_buffer
    def get_output_buffer(self, *args, **kwargs): return
_GRAS_Block.Block_get_output_buffer(self, *args, **kwargs)
RuntimeError: ASSERT FAIL not this->empty(i)


Could you help me in sorting this out?

Regards,
Sumedha



On Wed, Dec 18, 2013 at 10:23 PM, Tom Rondeau <t...@trondeau.com> wrote:

> On Wed, Dec 18, 2013 at 11:29 AM, Sumedha Goyal <sumedha1...@gmail.com>
> wrote:
> > Hi Tom,
> >
> > I have removed tb.wait(). Now the sequence is
> >
> > tb=top_block(options,0.8)
> > tb.start()
> > sleep(3)
> > tb.stop()
> >
> > I want my program to stop here and take new values which is not happening
> > right now. It executes till sleep(3) and then hangs somewhere.
>
> Sounds like an internal problem with your block.
>
> > You have asked to stop the flowgraph internally, kindly suggest a way to
> do
> > that. As I have mentioned earlier too, I have an event in the work()
> > function which when occurs the flowgraph should be terminated.
> > I tried using thread.exit in work function but unfortunately it is
> > terminating the whole program.
> >
> > Kindly suggest a way to bring the control back to main loop.
> >
> > Regards,
> > Sumedha
>
> Don't use thread.exit (pretty much ever). This sounds like you have
> something wrong with the threading model in your block. You a source
> block from GNU Radio (analog.sig_source_c or something) just to make
> sure the rest of the flowgraph is behaving properly. That is, that
> tb.stop is actually stopping the flowgraph. Then go back and try and
> debug your block.
>
> Tom
>
>
>
> > On Wed, Dec 18, 2013 at 8:43 PM, Tom Rondeau <t...@trondeau.com> wrote:
> >>
> >> On Wed, Dec 18, 2013 at 1:39 AM, Sumedha Goyal <sumedha1...@gmail.com>
> >> wrote:
> >> >
> >> >
> >> > ---------- Forwarded message ----------
> >> > From: Sumedha Goyal <sumedha1...@gmail.com>
> >> > Date: Wed, Dec 18, 2013 at 10:50 AM
> >> > Subject: Re: [Discuss-gnuradio] problem with top_block.stop()
> >> > To: Tom Rondeau <t...@trondeau.com>
> >> >
> >> >
> >> > Hi
> >> > My flowgraph does not stop naturally. I want to stop and start it
> again
> >> > using different value for a parameter as shown in my above question.
> >> > There is an event in my program where the flowgraph finishes it's job
> >> > with
> >> > first parameter value (which is 0.8 here), at the occurrence of that
> >> > event I
> >> > want the control of flowgraph to come back to the main(). Then I want
> to
> >> > restart the flowgraph with a new parameter value (which is 0.4 here).
> >> > Kindly guide me on this.
> >> >
> >> > Also, can I forcibly bring the control back to main() even when the
> >> > flowgraph doesn't have anything to stop its execution?
> >> >
> >> > Thanks and Regards,
> >> > Sumedha
> >>
> >>
> >> As I said, tb.wait() is a blocking call. If there is nothing to stop
> >> your flowgraph, you will continue to block at the tb.wait() line
> >> forever. If it helps, the top_block is implemented as a multi-threaded
> >> application where each block is in its own thread. The tb.wait()
> >> performs a thread join() on all threads in the flowgraph. So the
> >> flowgraph must exit before wait will exit. You have to stop your
> >> flowgraph internally somehow to continue.
> >>
> >> Tom
> >>
> >>
> >>
> >> > On Tue, Dec 17, 2013 at 11:24 PM, Tom Rondeau <t...@trondeau.com>
> wrote:
> >> >>
> >> >> On Tue, Dec 17, 2013 at 12:23 PM, Sumedha Goyal <
> sumedha1...@gmail.com>
> >> >> wrote:
> >> >> > I am trying to pass two different parameters to my top_block class
> >> >> > I m not able to do this please help. The control of program gets
> >> >> > stuck
> >> >> > at
> >> >> > tb.stop() and doesn't go beyond that.
> >> >> >
> >> >> > tb=top_block(options,0.8)
> >> >> > tb.start()
> >> >> > tb.wait()
> >> >> > tb.stop()
> >> >> > sleep(5)
> >> >> > print "I AM BACK"
> >> >> > tb1=top_block(options,0.4)
> >> >> > tb1.start()
> >> >> > tb1.wait()
> >> >> > tb1.stop()
> >> >> > sleep()
> >> >> >
> >> >> > Regards,
> >> >> > Sumedha
> >> >>
> >> >> Does your flowgraph in tb naturally stop? The tb.wait() is a blocking
> >> >> call and will halt the main loop there until all threads (blocks) in
> >> >> tb are done. If your flowgraph doesn't have something that stops
> >> >> execution (like a finite file or a blocks.head block), then it will
> >> >> continue to process forever and your tb.wait() will continue to
> block.
> >> >>
> >> >> Tom
> >> >
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Discuss-gnuradio mailing list
> >> > Discuss-gnuradio@gnu.org
> >> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> >> >
> >
> >
> >
> > _______________________________________________
> > Discuss-gnuradio mailing list
> > Discuss-gnuradio@gnu.org
> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> >
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to