discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Problem with thread scheduler


From: cdong8812
Subject: Re: [Discuss-gnuradio] Problem with thread scheduler
Date: Thu, 2 Aug 2012 10:04:05 -0700 (PDT)

Yeah, I'm using Ubuntu 10.04. Maybe I should make it more clear about the
structure of my code. Actually I'd like the spectrum sensing program to run
for a certain time and then quit. So I add a time control in my code. Below
is a more detailed structure:
Class Wimax_Receiver(gr.top_block): 
... 
    def add_fft_cal(self, fft_cal_block): 
        
        # Get new block 
        self.FFT_calculate = fft_cal_block 
                
        # Add FFT to output of USRP 
        self.connect(self.u, self.FFT_calculate) 

class ThreadClass(threading.Thread):
...

class tune(gr.feval_dd):
...

class parse_msg(object):
...


class FFT_Calculation(gr.top_block): 
... 
        self.wr = Wimax_Receiver() 
        self.wr.add_fft_cal(self.s2v) 
        self.connect(self.s2v, self.fft_cal, self.c2mag, self.log,
self.stats) 
        self.connect(self.wr)
  
  def set_center_freq(self):
      do something for time control and stop flowgraph by tb.stop()

def main_loop(tb):

   print out FFT amplitude and frequency information

if __name__ == '__main__':

    # Initiate a thread to run the program
    tr = ThreadClass()
    tr.start()

    # Create an object of FFT block
    tb = FFT_Calculation()
         
    try:            
        # Run the main block
        tb.run()
        main_loop(tb)
                        
    except KeyboardInterrupt:
        pass

>From the error message, I guess it's because when I shut down the flowgraph
in the set_center_freq function the usrp_uhd block is still streaming but
the thread scheduler has already terminate thread allocation for it. So in
order to avoid this issue, you recommend to update Ubuntu to 11 or 12? I
really appreciate it if you could help me fix this problem. 





Josh Blum-3 wrote:
> 
> 
> 
> On 07/31/2012 09:27 AM, cdong8812 wrote:
>> 
>> Hi Josh,
>> Thank you for the quick reply. I have went through previous post and find
>> one that had been fixed by your latest UHD build then. However I found
>> this
>> annoying problem again with latest master build and N210. The structure
>> of
>> my code is as follows:
>> Class Wimax_Receiver(gr.top_block):
>> ...
>>     def add_fft_cal(self, fft_cal_block):
>>         
>>         # Get new block
>>      self.FFT_calculate = fft_cal_block
>>              
>>      # Add FFT to output of USRP
>>      self.connect(self.u, self.FFT_calculate)
>> 
>> class FFT_Calculation(gr.top_block):
>> ...
>>         self.wr = Wimax_Receiver()
>>         self.wr.add_fft_cal(self.s2v)
>>         self.connect(self.s2v, self.fft_cal, self.c2mag, self.log,
>> self.stats)
>>      self.connect(self.wr)
>> 
>> 
>> Below is the error message:
>> 
>> http://old.nabble.com/file/p34235614/QQ%25E6%2588%25AA%25E5%259B%25BE20120731121754.jpg
>>  
>> 
>> 
> 
> Well, unless I am misreading, it seems like the flow graph finished
> execution.
> 
> Are you on ubuntu 10.04 by any chance? I know that the boost on that
> version, well its thread interrupt causes the various blocking mutex,
> cond, locks, etc to throw uncatchable exceptions... its unfortunate.
> 
> If thats not the explanation and its bombing, do you know what call,
> what line is the cause?
> 
> -josh
> 
>> 
>> 
>> 
>> Josh Blum-3 wrote:
>>>
>>>
>>>
>>> On 07/29/2012 03:57 PM, cdong8812 wrote:
>>>>
>>>> I have a problem with the thread scheduler in GNU Radio. I am using
>>>> USRP
>>>> N210
>>>> + RFX 2400 daughterboards with UHD. When I run my spectrum sensing
>>>> codes,
>>>> if
>>>> I stop the flowgraph it will show the thread-per-block number mismatch
>>>> error
>>>> message on screen. I wonder if there is any way to get rid of this
>>>> problem.
>>>
>>>
>>> Can you post the error message?
>>>
>>> -josh
>>>
>>>> My BOOST version is 1.40 and I am using Ubuntu 10.04. UHD information
>>>> is
>>>> shown below:
>>>>
>>>> address@hidden:/usr/local/src/gnuradio/build# uhd_find_devices
>>>> linux; GNU C++ version 4.4.3; Boost_104000;
>>>> UHD_003.004.002-181-g25649781
>>>>
>>>
>>> _______________________________________________
>>> Discuss-gnuradio mailing list
>>> address@hidden
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>
>>>
>> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Problem-with-thread-scheduler-tp34213396p34246603.html
Sent from the GnuRadio mailing list archive at Nabble.com.




reply via email to

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