commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8762 - gnuradio/branches/developers/eb/sched-wip/gnur


From: eb
Subject: [Commit-gnuradio] r8762 - gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime
Date: Mon, 30 Jun 2008 22:18:22 -0600 (MDT)

Author: eb
Date: 2008-06-30 22:18:21 -0600 (Mon, 30 Jun 2008)
New Revision: 8762

Added:
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.h
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
Removed:
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.h
Modified:
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/Makefile.am
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
   
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
Log:
Work-in-progress: re-refactored to create a simple scheduler object.


Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/Makefile.am
 2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/Makefile.am
 2008-07-01 04:18:21 UTC (rev 8762)
@@ -26,7 +26,9 @@
 noinst_LTLIBRARIES = libruntime.la libruntime-qa.la
 
 libruntime_la_LIBADD =         \
-       $(SHM_OPEN_LIBS)
+       $(SHM_OPEN_LIBS) \
+       $(BOOST_LDFLAGS) \
+       $(BOOST_THREAD_LIB)
 
 
 libruntime_la_SOURCES =                        \
@@ -48,6 +50,8 @@
        gr_pagesize.cc                          \
        gr_preferences.cc                       \
        gr_realtime.cc                          \
+       gr_scheduler.cc                         \
+       gr_scheduler_sts.cc                     \
        gr_scheduler_thread.cc                  \
        gr_single_threaded_scheduler.cc         \
        gr_sync_block.cc                        \
@@ -55,7 +59,6 @@
        gr_sync_interpolator.cc                 \
        gr_top_block.cc                         \
        gr_top_block_impl.cc                    \
-       gr_top_block_impl_sts.cc                \
        gr_tmp_path.cc                          \
        gr_vmcircbuf.cc                         \
        gr_vmcircbuf_mmap_shm_open.cc           \
@@ -95,6 +98,8 @@
        gr_preferences.h                        \
        gr_realtime.h                           \
        gr_runtime_types.h                      \
+       gr_scheduler.h                          \
+       gr_scheduler_sts.h                      \
        gr_scheduler_thread.h                   \
        gr_select_handler.h                     \
        gr_single_threaded_scheduler.h          \
@@ -103,7 +108,6 @@
        gr_sync_interpolator.h                  \
        gr_top_block.h                          \
        gr_top_block_impl.h                     \
-       gr_top_block_impl_sts.h                 \
        gr_timer.h                              \
        gr_tmp_path.h                           \
        gr_types.h                              \

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
        2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
        2008-07-01 04:18:21 UTC (rev 8762)
@@ -269,3 +269,14 @@
   }
 
 }
+
+gr_block_vector_t
+gr_flat_flowgraph::make_block_vector(gr_basic_block_vector_t &blocks)
+{
+  gr_block_vector_t result;
+  for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+    result.push_back(make_gr_block_sptr(*p));
+  }
+
+  return result;
+}

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h
 2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h
 2008-07-01 04:18:21 UTC (rev 8762)
@@ -55,6 +55,11 @@
 
   void dump();
 
+  /*!
+   * Make a vector of gr_block from a vector of gr_basic_block
+   */
+  static gr_block_vector_t make_block_vector(gr_basic_block_vector_t &blocks);
+
 private:
   gr_flat_flowgraph();
 

Added: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.cc
                             (rev 0)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.cc
     2008-07-01 04:18:21 UTC (rev 8762)
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_scheduler.h>
+
+gr_scheduler::gr_scheduler(gr_flat_flowgraph_sptr ffg)
+{
+}
+
+gr_scheduler::~gr_scheduler()
+{
+}


Property changes on: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.h
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.h
                              (rev 0)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.h
      2008-07-01 04:18:21 UTC (rev 8762)
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GR_SCHEDULER_H
+#define INCLUDED_GR_SCHEDULER_H
+
+#include <boost/utility.hpp>
+#include <gr_block.h>
+#include <gr_flat_flowgraph.h>
+
+
+class gr_scheduler;
+typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr;
+
+
+/*!
+ * \brief Abstract scheduler that takes a flattened flow graph and runs it.
+ *
+ * Preconditions: details, buffers and buffer readers have been assigned.
+ */
+class gr_scheduler : boost::noncopyable
+{
+
+public:
+  /*!
+   * \brief Construct a scheduler and begin evaluating the graph.
+   *
+   * The scheduler will continue running until all blocks until they
+   * report that they are done or the stop method is called.
+   */
+  gr_scheduler(gr_flat_flowgraph_sptr ffg);
+
+  virtual ~gr_scheduler();
+
+  /*!
+   * \brief Tell the scheduler to stop executing.
+   */
+  virtual void stop() = 0;
+
+  /*!
+   * \brief Block until the graph is done.
+   */
+  virtual void wait() = 0;
+};
+
+#endif /* INCLUDED_GR_SCHEDULER_H */


Property changes on: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
                         (rev 0)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
 2008-07-01 04:18:21 UTC (rev 8762)
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_scheduler_sts.h>
+
+gr_scheduler_sptr
+gr_scheduler_sts::make(gr_flat_flowgraph_sptr ffg)
+{
+  return gr_scheduler_sptr(new gr_scheduler_sts(ffg));
+}
+
+gr_scheduler_sts::gr_scheduler_sts(gr_flat_flowgraph_sptr ffg)
+  : gr_scheduler(ffg)
+{
+  // Split the flattened flow graph into discrete partitions, each
+  // of which is topologically sorted.
+
+  std::vector<gr_basic_block_vector_t> graphs = ffg->partition();
+
+  // For each partition, create a thread to evaluate it using
+  // an instance of the gr_single_threaded_scheduler
+
+  for (std::vector<gr_basic_block_vector_t>::iterator p = graphs.begin();
+       p != graphs.end(); p++) {
+
+    gr_block_vector_t blocks = gr_flat_flowgraph::make_block_vector(*p);
+    
+    // FIXME create the thread
+    // d_threads.create_thread(...)
+  }
+}
+
+gr_scheduler_sts::~gr_scheduler_sts()
+{
+  stop();
+}
+
+void
+gr_scheduler_sts::stop()
+{
+  d_threads.interrupt_all();
+}
+
+void
+gr_scheduler_sts::wait()
+{
+  d_threads.join_all();
+}


Property changes on: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
                          (rev 0)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
  2008-07-01 04:18:21 UTC (rev 8762)
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_SCHEDULER_STS_H
+#define INCLUDED_GR_SCHEDULER_STS_H
+
+#include <gr_scheduler.h>
+#include <boost/thread.hpp>
+
+/*!
+ * \brief Concrete scheduler that uses the single_threaded_scheduler
+ */
+class gr_scheduler_sts : public gr_scheduler
+{
+  std::vector<gr_basic_block_vector_t> d_graphs;
+  boost::thread_group                 d_threads;
+
+protected:
+  /*!
+   * \brief Construct a scheduler and begin evaluating the graph.
+   *
+   * The scheduler will continue running until all blocks until they
+   * report that they are done or the stop method is called.
+   */
+  gr_scheduler_sts(gr_flat_flowgraph_sptr ffg);
+
+public:
+  static gr_scheduler_sptr make(gr_flat_flowgraph_sptr ffg);
+
+  ~gr_scheduler_sts();
+
+  /*!
+   * \brief Tell the scheduler to stop executing.
+   */
+  void stop();
+
+  /*!
+   * \brief Block until the graph is done.
+   */
+  void wait();
+};
+
+
+
+
+#endif /* INCLUDED_GR_SCHEDULER_STS_H */


Property changes on: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
     2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
     2008-07-01 04:18:21 UTC (rev 8762)
@@ -28,6 +28,7 @@
 #include <gr_block.h>
 #include <gr_block_detail.h>
 #include <gr_buffer.h>
+#include <boost/thread.hpp>
 #include <iostream>
 #include <limits>
 #include <assert.h>
@@ -162,6 +163,9 @@
   nalive = d_blocks.size ();
   while (d_enabled && nalive > 0){
 
+    if (boost::this_thread::interruption_requested())
+      break;
+
     gr_block           *m = d_blocks[bi].get ();
     gr_block_detail    *d = m->detail().get ();
 

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block.cc
     2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block.cc
     2008-07-01 04:18:21 UTC (rev 8762)
@@ -27,7 +27,6 @@
 #include <unistd.h>
 #include <gr_top_block.h>
 #include <gr_top_block_impl.h>
-#include <gr_top_block_impl_sts.h>
 #include <gr_io_signature.h>
 #include <iostream>
 
@@ -43,7 +42,7 @@
                   gr_make_io_signature(0,0,0))
   
 {
-  d_impl = new gr_top_block_impl_sts(this);
+  d_impl = new gr_top_block_impl(this);
 }
   
 gr_top_block::~gr_top_block()

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
        2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
        2008-07-01 04:18:21 UTC (rev 8762)
@@ -27,8 +27,7 @@
 #include <gr_top_block.h>
 #include <gr_top_block_impl.h>
 #include <gr_flat_flowgraph.h>
-#include <gr_scheduler_thread.h>
-#include <gr_local_sighandler.h>
+#include <gr_scheduler_sts.h>
 
 #include <stdexcept>
 #include <iostream>
@@ -38,10 +37,8 @@
 #define GR_TOP_BLOCK_IMPL_DEBUG 0
 
 gr_top_block_impl::gr_top_block_impl(gr_top_block *owner) 
-  : d_owner(owner),
-    d_running(false),
-    d_ffg(),
-    d_lock_count(0)
+  : d_owner(owner), d_ffg(),
+    d_state(IDLE), d_lock_count(0)
 {
 }
 
@@ -53,14 +50,13 @@
 void
 gr_top_block_impl::start()
 {
-  if (GR_TOP_BLOCK_IMPL_DEBUG)
-    std::cout << "start: entered " << this << std::endl;
+  gr_lock_guard        l(d_mutex);
 
-  if (d_running)
+  if (d_state != IDLE)
     throw std::runtime_error("top_block::start: top block already running or 
wait() not called after previous stop()");
 
   if (d_lock_count > 0)
-    throw std::runtime_error("top_block::start: can't call start with flow 
graph locked");
+    throw std::runtime_error("top_block::start: can't start with flow graph 
locked");
 
   // Create new flat flow graph by flattening hierarchy
   d_ffg = d_owner->flatten();
@@ -69,77 +65,71 @@
   d_ffg->validate();
   d_ffg->setup_connections();
 
-  // Execute scheduler threads
-  start_threads();
-  d_running = true;
+  d_scheduler = gr_scheduler_sts::make(d_ffg);
+  d_state = RUNNING;
 }
 
+void 
+gr_top_block_impl::stop()
+{
+  if (d_scheduler)
+    d_scheduler->stop();
+}
 
+
+void
+gr_top_block_impl::wait()
+{
+  if (d_scheduler)
+    d_scheduler->wait();
+
+  d_state = IDLE;
+}
+
 // N.B. lock() and unlock() cannot be called from a flow graph thread or
 // deadlock will occur when reconfiguration happens
 void
 gr_top_block_impl::lock()
 {
-  omni_mutex_lock lock(d_reconf);
+  gr_lock_guard lock(d_mutex);
   d_lock_count++;
-  if (GR_TOP_BLOCK_IMPL_DEBUG)
-    std::cout << "runtime: locked, count = " << d_lock_count <<  std::endl;
 }
 
 void
 gr_top_block_impl::unlock()
 {
-  omni_mutex_lock lock(d_reconf);
+  gr_lock_guard lock(d_mutex);
+
   if (d_lock_count <= 0){
     d_lock_count = 0;          // fix it, then complain
     throw std::runtime_error("unpaired unlock() call");
   }
 
   d_lock_count--;
-  if (GR_TOP_BLOCK_IMPL_DEBUG)
-    std::cout << "unlock: unlocked, count = " << d_lock_count << std::endl;
+  if (d_lock_count > 0 || d_state == IDLE) // nothing to do
+    return;
 
-  if (d_lock_count == 0) {
-    if (GR_TOP_BLOCK_IMPL_DEBUG)
-      std::cout << "unlock: restarting flowgraph" << std::endl;
-    restart();
-  }
+  restart();
 }
 
+/*
+ * restart is called with d_mutex held
+ */
 void
 gr_top_block_impl::restart()
 {
-  if (GR_TOP_BLOCK_IMPL_DEBUG)
-    std::cout << "restart: entered" << std::endl;
-
-  if (!d_running)
-    return;            // nothing to do
-
-  // Stop scheduler threads and wait for completion
-  stop();
+  stop();                   // Stop scheduler and wait for completion
   wait();
-  if (GR_TOP_BLOCK_IMPL_DEBUG)
-    std::cout << "restart: threads stopped" << std::endl;
 
   // Create new simple flow graph
   gr_flat_flowgraph_sptr new_ffg = d_owner->flatten();        
   new_ffg->validate();                // check consistency, sanity, etc
-
-  if (GR_TOP_BLOCK_IMPL_DEBUG) {
-      std::cout << std::endl << "*** Existing flat flowgraph @" << d_ffg << 
":" << std::endl;
-      d_ffg->dump();
-  }
   new_ffg->merge_connections(d_ffg);   // reuse buffers, etc
-
-  if (GR_TOP_BLOCK_IMPL_DEBUG) {
-    std::cout << std::endl << "*** New flat flowgraph after merge @" << 
new_ffg << ":" << std::endl;
-    new_ffg->dump();
-  }
-  
   d_ffg = new_ffg;
 
-  start_threads();
-  d_running = true;
+  // Create a new scheduler to execute it
+  d_scheduler = gr_scheduler_sts::make(d_ffg);
+  d_state = RUNNING;
 }
 
 void
@@ -148,14 +138,3 @@
   if (d_ffg)
     d_ffg->dump();
 }
-
-gr_block_vector_t
-gr_top_block_impl::make_gr_block_vector(gr_basic_block_vector_t blocks)
-{
-  gr_block_vector_t result;
-  for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
-    result.push_back(make_gr_block_sptr(*p));
-  }
-
-  return result;
-}

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
 2008-07-01 01:19:12 UTC (rev 8761)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
 2008-07-01 04:18:21 UTC (rev 8762)
@@ -23,8 +23,12 @@
 #ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H
 #define INCLUDED_GR_TOP_BLOCK_IMPL_H
 
-#include <gr_scheduler_thread.h>
+#include <gr_scheduler.h>
+#include <boost/thread.hpp>
 
+typedef boost::mutex                   gr_mutex;       // FIXME move these 
elsewhere
+typedef boost::lock_guard<boost::mutex>        gr_lock_guard;
+
 /*!
  *\brief Abstract implementation details of gr_top_block
  * \ingroup internal
@@ -37,16 +41,16 @@
 {
 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
   void lock();
@@ -59,22 +63,16 @@
   
 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
+  gr_mutex                       d_mutex;      // protects d_state and 
d_lock_count
+  tb_state                      d_state;
   int                            d_lock_count;
-
-  virtual void start_threads() = 0;
-
-/*!
- * 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();
 };

Deleted: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.cc

Deleted: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_top_block_impl_sts.h





reply via email to

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