[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Timers
From: |
Marcus D. Leech |
Subject: |
Re: [Discuss-gnuradio] Timers |
Date: |
Wed, 25 Feb 2009 09:01:38 -0500 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20090105) |
Eric Blossom wrote:
> No. In general it's virtually impossible to safely uses threads and
> signals together. If you need a timer, one way to get it is to use a
> dedicated thread that manages the timer queue, then send messages to
> those who want them when the timer expires.
>
> [I'll be implementing something like this in the next few months]
>
> Eric
>
>
Actually, it turned out to be remarkably easy. With gr-generated code,
the main program is just:
topblock.start()
raw_input()
topbloack.stop()
Which means that main runs in a separate thread. So, I simply replaced
raw_input() with a loop that goes to
sleep for 250msec, then checks the control file, then goes to sleep
again. A bit in the control file asks the
Python flowgraph to exit. Simple.
Wish there was an easy way to merge grc-generated code with stuff like this.
--
Marcus Leech
Principal Investigator, Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org