commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4909 - gnuradio/branches/developers/eb/ibu/mblock/src


From: eb
Subject: [Commit-gnuradio] r4909 - gnuradio/branches/developers/eb/ibu/mblock/src/lib
Date: Fri, 6 Apr 2007 21:05:37 -0600 (MDT)

Author: eb
Date: 2007-04-06 21:05:36 -0600 (Fri, 06 Apr 2007)
New Revision: 4909

Added:
   
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.cc
   
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.h
Removed:
   
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_mblock.cc
   
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_mblock.h
Modified:
   gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime.cc
   gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc
   gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.h
Log:
Renamed mb_runtime_thread_per_mblock to mb_runtime_thread_per_block.
I kept misspelling it.  This must be its "right name" ;)


Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime.cc    
2007-04-07 03:02:35 UTC (rev 4908)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime.cc    
2007-04-07 03:05:36 UTC (rev 4909)
@@ -24,12 +24,12 @@
 #endif
 
 #include <mb_runtime.h>
-#include <mb_runtime_thread_per_mblock.h>
+#include <mb_runtime_thread_per_block.h>
 
 mb_runtime_sptr
 mb_make_runtime()
 {
-  return mb_runtime_sptr(new mb_runtime_thread_per_mblock());
+  return mb_runtime_sptr(new mb_runtime_thread_per_block());
 }
 
 mb_runtime::~mb_runtime()

Copied: 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.cc
 (from rev 4908, 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_mblock.cc)
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.cc
                           (rev 0)
+++ 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.cc
   2007-04-07 03:05:36 UTC (rev 4909)
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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 <mb_runtime_thread_per_block.h>
+#include <mb_mblock.h>
+#include <mb_mblock_impl.h>
+#include <mb_class_registry.h>
+#include <mb_exception.h>
+#include <omnithread.h>
+
+
+
+
+mb_runtime_thread_per_block::mb_runtime_thread_per_block()
+  : d_runtime_cond(&d_mutex)
+{
+  // nop for now
+}
+
+mb_runtime_thread_per_block::~mb_runtime_thread_per_block()
+{
+  // nop for now
+}
+
+
+bool
+mb_runtime_thread_per_block::run(const std::string &instance_name,
+                                 const std::string &class_name,
+                                 pmt_t user_arg)
+{
+  class initial_visitor : public mb_visitor
+  {
+  public:
+    bool operator()(mb_mblock *mblock)
+    {
+      mblock->initial_transition();
+      return true;
+    }
+  };
+
+  initial_visitor      visitor;
+
+  mb_mblock_sptr top = create_component(instance_name, class_name, user_arg);
+
+  // FIXME wait for barrier, then ask each mblock to run its initial_transition
+
+  return true;
+}
+
+//
+// FIXME create the thread, then create the component in the thread
+//
+mb_mblock_sptr
+mb_runtime_thread_per_block::create_component(const std::string &instance_name,
+                                              const std::string &class_name,
+                                              pmt_t user_arg)
+{
+  mb_mblock_maker_t maker;
+  if (!mb_class_registry::lookup_maker(class_name, &maker))
+    throw mbe_no_such_class(0, class_name + " (in " + instance_name + ")");
+
+  return maker(this, instance_name, user_arg);
+}

Copied: 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.h
 (from rev 4908, 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_mblock.h)
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.h
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_block.h
    2007-04-07 03:05:36 UTC (rev 4909)
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_MB_RUNTIME_THREAD_PER_MBLOCK_H
+#define INCLUDED_MB_RUNTIME_THREAD_PER_MBLOCK_H
+
+#include <mb_runtime.h>
+
+/*!
+ * \brief Concrete runtime that uses a thread per mblock
+ * \implementation
+ *
+ * This is all implementation details.
+ */
+class mb_runtime_thread_per_block : public mb_runtime
+{
+public:
+  omni_mutex           d_mutex;
+  omni_condition       d_runtime_cond;   // runtime waits here when it's got 
nothing to do
+
+  mb_runtime_thread_per_block();
+  ~mb_runtime_thread_per_block();
+
+  bool run(const std::string &instance_name,
+          const std::string &class_name,
+          pmt_t user_arg);
+
+protected:
+  mb_mblock_sptr
+  create_component(const std::string &instance_name,
+                  const std::string &class_name,
+                  pmt_t user_arg);
+};
+
+#endif /* INCLUDED_MB_RUNTIME_THREAD_PER_MBLOCK_H */

Deleted: 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_mblock.cc

Deleted: 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_runtime_thread_per_mblock.h

Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc     
2007-04-07 03:02:35 UTC (rev 4908)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc     
2007-04-07 03:05:36 UTC (rev 4909)
@@ -23,12 +23,12 @@
 #include <config.h>
 #endif
 #include <mb_worker.h>
-#include <mb_runtime_thread_per_mblock.h>
+#include <mb_runtime_thread_per_block.h>
 #include <mb_exception.h>
 
 
 
-mb_worker::mb_worker(mb_runtime_thread_per_mblock *runtime,
+mb_worker::mb_worker(mb_runtime_thread_per_block *runtime,
                     mb_mblock_maker_t maker,
                     const std::string &instance_name,
                     pmt_t user_arg)

Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.h      
2007-04-07 03:02:35 UTC (rev 4908)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.h      
2007-04-07 03:05:36 UTC (rev 4909)
@@ -27,10 +27,10 @@
 #include <mb_class_registry.h>
 
 
-class mb_runtime_thread_per_mblock;
+class mb_runtime_thread_per_block;
 
 /*!
- * \brief Worker thread for thread_per_mblock runtime
+ * \brief Worker thread for thread_per_block runtime
  * \implementation
  */
 class mb_worker : public omni_thread
@@ -58,7 +58,7 @@
   /*
    * Args used by new thread to create mb_mblock
    */
-  mb_runtime_thread_per_mblock *d_runtime;
+  mb_runtime_thread_per_block *d_runtime;
   mb_mblock_maker_t            d_maker;
   std::string                  d_instance_name;
   pmt_t                                d_user_arg;
@@ -76,7 +76,7 @@
   worker_state_t               d_state;
   cause_of_death_t             d_why_dead;
 
-  mb_worker(mb_runtime_thread_per_mblock *runtime,
+  mb_worker(mb_runtime_thread_per_block *runtime,
            mb_mblock_maker_t maker,
            const std::string &instance_name,
            pmt_t user_arg);





reply via email to

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