discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Gnuradio locking up


From: Philip Balister
Subject: Re: [Discuss-gnuradio] Gnuradio locking up
Date: Tue, 22 Nov 2011 11:28:43 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 11/22/2011 11:02 AM, Rachel Kroll wrote:
> 
> On Nov 22, 2011, at 7:56 AM, Marcus D. Leech wrote:
> 
>> On 22/11/11 10:48 AM, Rachel Kroll wrote:
>>> It's pretty easy to get wedged forever if you call lock and unlock a lot in 
>>> conjunction with connect and disconnect.  Sooner or later, you'll hit a 
>>> race and things will get stuck.
>>>
>>> I have a simple reproduction case if anyone is interested.  It'll hang 
>>> reliably after a few dozen iterations.
>>>
>>>
>> That's the type of information that shouldn't be withheld from this
>> list, and by implication, the
>>  developers.  Don't assume that because you've found a
>> bug/unexpected-behaviour, that the developers
>>  know about it, and are working on a fix.
> 
> It's come up a few times in the mailing list archives.  The usual solution 
> seems to be "add more sleeps", which of course is not a fix.
> 
> Anyway, here's the reproduction case:
> 

How do you compile this? I put it in a file and made a couple fo quick
stabs at it.

> #include <gnuradio/gr_file_sink.h>

This raises a question, the standard search paths find this file, but
the gnuradio headers have lines like:

#include <gr_core_api.h>

which force you to add -I/usr/local/include/gnuradio to the compile
command. I don't like mixing my include styles and feel searching both
paths can lead to problems.

Philip


> #include <gnuradio/gr_sig_source_f.h>
> #include <gnuradio/gr_hier_block2.h>
> #include <gnuradio/gr_io_signature.h>
> #include <gnuradio/gr_top_block.h>
> 
> static void connect(gr_top_block_sptr block, gr_sig_source_f_sptr source,
>                     gr_hier_block2_sptr block2) {
>   fprintf(stderr, "connect: calling lock, connect, unlock\n");
>   block->lock();
>   block->connect(source, 0, block2, 0);
>   block->unlock();
>   fprintf(stderr, "connect: done\n");
> }
> 
> static void disconnect(gr_top_block_sptr block, gr_sig_source_f_sptr source,
>                        gr_hier_block2_sptr block2) {
>   fprintf(stderr, "disconnect: calling block->lock\n");
>   block->lock();
> 
>   fprintf(stderr, "disconnect: calling block->disconnect\n");
>   block->disconnect(source, 0, block2, 0);
> 
>   fprintf(stderr, "disconnect: calling block->unlock\n");
>   block->unlock();                  // It usually hangs here.
> 
>   fprintf(stderr, "disconnect: done\n");
> }
> 
> int main(int argc, char** argv) {
>   // Inner block: block to sink.
>   gr_hier_block2_sptr inner;
>   inner = gr_make_hier_block2("inner",
>                               gr_make_io_signature(1, 1, sizeof(float)),
>                               gr_make_io_signature(0, 0, 0));
> 
>   gr_file_sink_sptr sink;
>   sink = gr_make_file_sink(sizeof(float), "/dev/null");
>   inner->connect(inner, 0, sink, 0);
> 
>   // Outer block: signal source to inner block.
>   gr_top_block_sptr outer = gr_make_top_block("outer");
>   gr_sig_source_f_sptr src = gr_make_sig_source_f(11025, GR_COS_WAVE,
>                                                   400, .1, 0);
> 
>   // Hook it up and get it going.
>   connect(outer, src, inner);
>   outer->start();
> 
>   // Frob it until we die.
>   while (true) {
>     disconnect(outer, src, inner);
>     fprintf(stderr, "\n\n------------------------\n\n");
> 
>     connect(outer, src, inner);
>   }
> 
>   return 0;
> }
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]