Merge commit 'v3.3.0' into upstream
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_top_block_impl.h
index 003afec9382ed791e66de4207ac542eaefdf0ac0..ef28dd8292124803f1162b85515b2313d4da0475 100644 (file)
@@ -23,7 +23,8 @@
 #ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H
 #define INCLUDED_GR_TOP_BLOCK_IMPL_H
 
-#include <gr_scheduler_thread.h>
+#include <gr_scheduler.h>
+#include <gruel/thread.h>
 
 /*!
  *\brief Abstract implementation details of gr_top_block
@@ -37,48 +38,40 @@ class gr_top_block_impl
 {
 public:
   gr_top_block_impl(gr_top_block *owner);
-  virtual ~gr_top_block_impl();
+  ~gr_top_block_impl();
 
   // Create and start scheduler threads
-  virtual void start();
+  void start();
 
   // Signal scheduler threads to stop
-  virtual void stop() = 0;
+  void stop();
 
   // Wait for scheduler threads to exit
-  virtual void wait() = 0;
+  void wait();
 
   // Lock the top block to allow reconfiguration
-  virtual void lock();
+  void lock();
 
   // Unlock the top block at end of reconfiguration
-  virtual void unlock();
+  void unlock();
 
   // Dump the flowgraph to stdout
   void dump();
-
-  // Return true if flowgraph is running
-  bool is_running() const { return d_running; }
   
 protected:
     
+  enum tb_state { IDLE, RUNNING };
+
   gr_top_block                  *d_owner;
-  bool                           d_running;
   gr_flat_flowgraph_sptr         d_ffg;
+  gr_scheduler_sptr             d_scheduler;
 
-  omni_mutex                     d_reconf;     // protects d_lock_count
+  gruel::mutex                   d_mutex;      // protects d_state and d_lock_count
+  tb_state                      d_state;
   int                            d_lock_count;
-
-  virtual void start_threads() = 0;
-  virtual void restart();
-
-/*!
- * Make a vector of gr_block from a vector of gr_basic_block
- *
- * Pass-by-value to avoid problem with possible asynchronous modification
- */
-  static gr_block_vector_t make_gr_block_vector(gr_basic_block_vector_t blocks);
-
+  
+private:
+  void restart();
 };
 
 #endif /* INCLUDED_GR_TOP_BLOCK_IMPL_H */