a running flow graph is static, and can't be changed. there are two ways to implement reconfigurability:
use lock() / unlock()
create blocks that react dynamically
using lock() and unlock(), you will actually stop the flow graph, and can then disconnect and re-connect blocks. in the following example, the flow graph will run for a second,
the stop the execution (lock), disconnect the source, connect a different one, and resume. the resulting file will first have data from the vector source, then lots of zeros.
note that this is not meant for sample-precision timing, but rather for situations where time does not really matter.
if sample-timing is an issue, use general blocks to react to certain events. in the following example, we assume that you have written a general block which stops reading from the
first sink at a given time, and then seamlessly switches over to the second input:
there are many blocks that react to input data, or incoming tags.
參考:http://gnuradio.org/redmine/projects/gnuradio/wiki/faq#how-can-i-reconfigure-a-flow-graph-how-do-i-use-lock-unlock