discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] mc4020.source causing lockup on exit


From: Ben Gelb
Subject: [Discuss-gnuradio] mc4020.source causing lockup on exit
Date: Sun, 06 Mar 2005 23:30:10 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20050207)

Hi All -

I just dusted off my mc4020 board and compiled and installed the new GNU Radio codebase this past weekend. I've gotten some of the examples running and can receive some local AM and FM stations.

Oftentimes when I exit a GNU Radio program that uses the mc4020.source my computer will lock up completely - I have to hit the reset button to restart it. I remember having had this problem when I had experimented with GNU Radio in the past (versions 0.8 and 0.9) but it had been a bit less frequent. Now it happens a majority of the time, and presents a pretty serious impediment.

I did some diving in the mailing list archives and found the following:

http://lists.gnu.org/archive/html/discuss-gnuradio/2003-06/msg00027.html

This post describes a similar problem (though in a much older version of GNU Radio), and proposes the following workaround:

-> the device must be properly stopped
-> a pause of 1 second is needed before the device stop (don't know exactly why...)
-> the device must be properly closed

I accomplished this in python with the following:

def __del__ (self):
       print "now closing"
       self.stop()
       self.disconnect_all()
       time.sleep(1)
       del self.src
       print "source deleted"

This code gets called when you exit the program.

And what do you know - no more lockups!

To try to get a better handle on what was going on, I added some debugging output to mc4020_source.cc in the gr-mc4020 package to determine when/if the mc4020_source destructor was being called and if it was finishing successfully.

What I found was that when exiting a program causes the machine to lock up, the destructor is not called prior to the lockup. When the program exits successfully (no lockup), the destructor is called and completes without problem.

Adding the above python code, or in fact just

def __del__ (self):
       time.sleep(1)

Seems to cause the destructor to always be called and complete successfully, and the machine never locks up.

It seems that this one second delay somehow ensures the proper closing up of the mc4020 and proper program termination. This seems very mysterious to me. I am not terribly familiar with the inner workings of python, and so I'm not really sure what to do next to try to solve this problem. But it seems like it should be possible to fix this and eliminate the need for the magic one second delay.

Does anybody have any inklings as to how?

Thanks,
Ben




reply via email to

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