Changeset 8689

Show
Ignore:
Timestamp:
06/24/08 14:48:39
Author:
eb
Message:

removed is_running method from gr_top_block

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block.cc

    r8665 r8689  
    9797  d_impl->dump(); 
    9898} 
    99  
    100 bool 
    101 gr_top_block::is_running() 
    102 { 
    103   return d_impl->is_running(); 
    104 } 
  • gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block.h

    r8466 r8689  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2007 Free Software Foundation, Inc. 
     3 * Copyright 2007,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    104104   */ 
    105105  void dump(); 
    106  
    107   /*! 
    108    * Returns true if flowgraph is running 
    109    */ 
    110   bool is_running(); 
    111106}; 
    112107 
  • gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block.i

    r8466 r8689  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2007 Free Software Foundation, Inc. 
     3 * Copyright 2007,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    4747  void lock(); 
    4848  void unlock() throw (std::runtime_error); 
    49   bool is_running(); 
    5049  void dump(); 
    5150}; 
  • gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc

    r8665 r8689  
    5858 
    5959  if (d_running) 
    60     throw std::runtime_error("top block already running or wait() not called after previous stop()"); 
     60    throw std::runtime_error("top_block::start: top block already running or wait() not called after previous stop()"); 
     61 
     62  if (d_lock_count > 0) 
     63    throw std::runtime_error("top_block::start: can't call start with flow graph locked"); 
    6164 
    6265  // Create new flat flow graph by flattening hierarchy 
     
    6972  // Execute scheduler threads 
    7073  start_threads(); 
     74  d_running = true; 
    7175} 
    7276 
     
    8791{ 
    8892  omni_mutex_lock lock(d_reconf); 
    89   if (d_lock_count <= 0) 
     93  if (d_lock_count <= 0){ 
     94    d_lock_count = 0;           // fix it, then complain 
    9095    throw std::runtime_error("unpaired unlock() call"); 
     96  } 
    9197 
    9298  d_lock_count--; 
     
    108114 
    109115  if (!d_running) 
    110     throw std::runtime_error("top block is not running"); 
     116    return;            // nothing to do 
    111117 
    112118  // Stop scheduler threads and wait for completion 
     
    134140 
    135141  start_threads(); 
     142  d_running = true; 
    136143} 
    137144 
  • gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block_impl.h

    r8665 r8689  
    5050 
    5151  // Lock the top block to allow reconfiguration 
    52   virtual void lock(); 
     52  void lock(); 
    5353 
    5454  // Unlock the top block at end of reconfiguration 
    55   virtual void unlock(); 
     55  void unlock(); 
    5656 
    5757  // Dump the flowgraph to stdout 
    5858  void dump(); 
    59  
    60   // Return true if flowgraph is running 
    61   bool is_running() const { return d_running; } 
    6259   
    6360protected: 
     
    7168 
    7269  virtual void start_threads() = 0; 
    73   virtual void restart(); 
    7470 
    7571/*! 
     
    8076  static gr_block_vector_t make_gr_block_vector(gr_basic_block_vector_t blocks); 
    8177 
     78private: 
     79  void restart(); 
    8280}; 
    8381 
  • gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.cc

    r8665 r8689  
    8686    thread->start(); 
    8787  } 
    88  
    89   d_running = true; 
    9088} 
    9189 
  • gnuradio/trunk/gr-gpio/src/python/gpio_usrp_siggen.py

    r7618 r8689  
    9191 
    9292    def _configure_graph (self, type): 
    93         was_running = self.is_running () 
    94         if was_running: 
    95             self.stop () 
    96         self.disconnect_all () 
    97         if type == gr.GR_SIN_WAVE: 
    98             self.connect (self.siggen, self.u) 
    99             # self.connect (self.siggen, self.file_sink) 
    100             self.siggen.set_waveform (type) 
    101             self.src = self.siggen 
    102         elif type == gr.GR_UNIFORM or type == gr.GR_GAUSSIAN: 
    103             self.connect (self.noisegen, self.u) 
    104             self.noisegen.set_type (type) 
    105             self.src = self.noisegen 
    106         elif type == gr.GR_CONST_WAVE: 
    107             self.connect (self.vecgen, self.u) 
    108             self.src = self.vecgen 
    109         else: 
    110             raise ValueError, type 
    111         if was_running: 
    112             self.start () 
     93        try: 
     94            self.lock() 
     95            self.disconnect_all () 
     96            if type == gr.GR_SIN_WAVE: 
     97                self.connect (self.siggen, self.u) 
     98                # self.connect (self.siggen, self.file_sink) 
     99                self.siggen.set_waveform (type) 
     100                self.src = self.siggen 
     101            elif type == gr.GR_UNIFORM or type == gr.GR_GAUSSIAN: 
     102                self.connect (self.noisegen, self.u) 
     103                self.noisegen.set_type (type) 
     104                self.src = self.noisegen 
     105            elif type == gr.GR_CONST_WAVE: 
     106                self.connect (self.vecgen, self.u) 
     107                self.src = self.vecgen 
     108            else: 
     109                raise ValueError, type 
     110        finally: 
     111            self.unlock() 
    113112 
    114113    def set_freq(self, target_freq): 
  • gnuradio/trunk/gr-utils/src/python/usrp_siggen.py

    r6477 r8689  
    7070 
    7171    def _configure_graph (self, type): 
    72         was_running = self.is_running () 
    73         if was_running: 
    74             self.stop () 
    75         self.disconnect_all () 
    76         if type == gr.GR_SIN_WAVE or type == gr.GR_CONST_WAVE: 
    77             self.connect (self.siggen, self.u) 
    78             # self.connect (self.siggen, self.file_sink) 
    79             self.siggen.set_waveform (type) 
    80             self.src = self.siggen 
    81         elif type == gr.GR_UNIFORM or type == gr.GR_GAUSSIAN: 
    82             self.connect (self.noisegen, self.u) 
    83             self.noisegen.set_type (type) 
    84             self.src = self.noisegen 
    85         else: 
    86             raise ValueError, type 
    87         if was_running: 
    88             self.start () 
     72        try: 
     73            self.lock() 
     74            self.disconnect_all () 
     75            if type == gr.GR_SIN_WAVE or type == gr.GR_CONST_WAVE: 
     76                self.connect (self.siggen, self.u) 
     77                # self.connect (self.siggen, self.file_sink) 
     78                self.siggen.set_waveform (type) 
     79                self.src = self.siggen 
     80            elif type == gr.GR_UNIFORM or type == gr.GR_GAUSSIAN: 
     81                self.connect (self.noisegen, self.u) 
     82                self.noisegen.set_type (type) 
     83                self.src = self.noisegen 
     84            else: 
     85                raise ValueError, type 
     86        finally: 
     87            self.unlock() 
    8988 
    9089    def set_freq(self, target_freq):