commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8764 - in gnuradio/branches/developers/eb/sched-wip:


From: eb
Subject: [Commit-gnuradio] r8764 - in gnuradio/branches/developers/eb/sched-wip: config gnuradio-core/src/lib gnuradio-core/src/lib/runtime gruel/src/include/gruel gruel/src/lib mblock/src/lib pmt/src/lib usrp/host/apps usrp/host/apps-inband usrp/host/lib/inband
Date: Tue, 1 Jul 2008 01:04:15 -0600 (MDT)

Author: eb
Date: 2008-07-01 01:04:14 -0600 (Tue, 01 Jul 2008)
New Revision: 8764

Added:
   
gnuradio/branches/developers/eb/sched-wip/gruel/src/include/gruel/thread_body_wrapper.h
   
gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/thread_body_wrapper.cc
Modified:
   gnuradio/branches/developers/eb/sched-wip/config/grc_gnuradio_core.m4
   gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/Makefile.am
   
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_scheduler_sts.cc
   gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/Makefile.am
   gnuradio/branches/developers/eb/sched-wip/mblock/src/lib/Makefile.am
   gnuradio/branches/developers/eb/sched-wip/pmt/src/lib/Makefile.am
   gnuradio/branches/developers/eb/sched-wip/usrp/host/apps-inband/Makefile.am
   gnuradio/branches/developers/eb/sched-wip/usrp/host/apps/Makefile.am
   gnuradio/branches/developers/eb/sched-wip/usrp/host/lib/inband/Makefile.am
Log:
working! work-in-progress...

Modified: gnuradio/branches/developers/eb/sched-wip/config/grc_gnuradio_core.m4
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/config/grc_gnuradio_core.m4       
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/config/grc_gnuradio_core.m4       
2008-07-01 07:04:14 UTC (rev 8764)
@@ -28,7 +28,8 @@
        gnuradio_core_PYDIRPATH=$pythondir
     ])
 
-    dnl Don't do gnuradio-core if omnithread skipped
+    dnl Don't do gnuradio-core if gruel or omnithread skipped
+    GRC_CHECK_DEPENDENCY(gnuradio-core, gruel)
     GRC_CHECK_DEPENDENCY(gnuradio-core, omnithread)
 
     dnl If execution gets to here, $passed will be:

Modified: 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/Makefile.am 
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/Makefile.am 
2008-07-01 07:04:14 UTC (rev 8764)
@@ -31,11 +31,14 @@
 lib_LTLIBRARIES = libgnuradio-core.la libgnuradio-core-qa.la
 
 libgnuradio_core_la_SOURCES = bug_work_around_6.cc
-libgnuradio_core_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgnuradio_core_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 \
+                             $(BOOST_LDFLAGS)
 
 libgnuradio_core_qa_la_SOURCES = bug_work_around_6.cc
 libgnuradio_core_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 \
                                 $(LIBGNURADIO_CORE_EXTRA_LDFLAGS)
+
+
 libgnuradio_core_la_LIBADD  =          \
        filter/libfilter.la             \
        g72x/libccitt.la                \
@@ -47,7 +50,9 @@
        reed-solomon/librs.la           \
        runtime/libruntime.la           \
        $(OMNITHREAD_LA)                \
-       $(FFTW3F_LIBS)
+       $(GRUEL_LA)                     \
+       $(FFTW3F_LIBS)                  \
+       $(BOOST_THREAD_LIB)
 
 libgnuradio_core_qa_la_LIBADD  =       \
        filter/libfilter-qa.la          \

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 06:20:01 UTC (rev 8763)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/Makefile.am
 2008-07-01 07:04:14 UTC (rev 8764)
@@ -21,14 +21,12 @@
 
 include $(top_srcdir)/Makefile.common
 
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
+AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) 
$(GRUEL_INCLUDES) $(WITH_INCLUDES)
 
 noinst_LTLIBRARIES = libruntime.la libruntime-qa.la
 
 libruntime_la_LIBADD =         \
-       $(SHM_OPEN_LIBS) \
-       $(BOOST_LDFLAGS) \
-       $(BOOST_THREAD_LIB)
+       $(SHM_OPEN_LIBS)
 
 
 libruntime_la_SOURCES =                        \

Modified: 
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
 2008-07-01 06:20:01 UTC (rev 8763)
+++ 
gnuradio/branches/developers/eb/sched-wip/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
 2008-07-01 07:04:14 UTC (rev 8764)
@@ -23,7 +23,30 @@
 #include <config.h>
 #endif
 #include <gr_scheduler_sts.h>
+#include <gr_single_threaded_scheduler.h>
+#include <gruel/thread_body_wrapper.h>
 
+class sts_container
+{
+  gr_block_vector_t    d_blocks;
+  
+public:
+
+  sts_container(gr_block_vector_t blocks)
+    : d_blocks(blocks)
+  {
+  }
+
+  void operator()()
+  {
+    gr_single_threaded_scheduler_sptr sts =
+      gr_make_single_threaded_scheduler(d_blocks);
+
+    sts->run();
+  }
+};
+
+
 gr_scheduler_sptr
 gr_scheduler_sts::make(gr_flat_flowgraph_sptr ffg)
 {
@@ -45,9 +68,8 @@
        p != graphs.end(); p++) {
 
     gr_block_vector_t blocks = gr_flat_flowgraph::make_block_vector(*p);
-    
-    // FIXME create the thread
-    // d_threads.create_thread(...)
+    
d_threads.create_thread(gruel::thread_body_wrapper<sts_container>(sts_container(blocks),
+                                                      
"single-threaded-scheduler"));
   }
 }
 

Added: 
gnuradio/branches/developers/eb/sched-wip/gruel/src/include/gruel/thread_body_wrapper.h
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gruel/src/include/gruel/thread_body_wrapper.h
                             (rev 0)
+++ 
gnuradio/branches/developers/eb/sched-wip/gruel/src/include/gruel/thread_body_wrapper.h
     2008-07-01 07:04:14 UTC (rev 8764)
@@ -0,0 +1,68 @@
+/* -*- 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_THREAD_BODY_WRAPPER_H
+#define INCLUDED_THREAD_BODY_WRAPPER_H
+
+#include <boost/thread.hpp>
+#include <exception>
+#include <iostream>
+
+namespace gruel 
+{
+
+  void mask_signals();
+
+  template <class F>
+  class thread_body_wrapper
+  {
+    F          d_f;
+    std::string d_name;
+
+  public:
+
+    explicit thread_body_wrapper(F f, const std::string &name="")
+      : d_f(f), d_name(name) {}
+
+    void operator()()
+    {
+      mask_signals();
+
+      try {
+       d_f();
+      }
+      catch(boost::thread_interrupted const &)
+      {
+      }
+      catch(std::exception const &e)
+      {
+       std::cerr << "thread[" << d_name << "]: "
+                 << e.what() << std::endl;
+      }
+      catch(...)
+      {
+       std::cerr << "thread[" << d_name << "]: "
+                 << "caught unrecognized exception\n";
+      }
+    }
+  };
+}
+
+#endif /* INCLUDED_THREAD_BODY_WRAPPER_H */


Property changes on: 
gnuradio/branches/developers/eb/sched-wip/gruel/src/include/gruel/thread_body_wrapper.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/Makefile.am 
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/Makefile.am 
2008-07-01 07:04:14 UTC (rev 8764)
@@ -21,13 +21,14 @@
 
 include $(top_srcdir)/Makefile.common
 
-AM_CPPFLAGS = $(DEFINES) $(BOOST_CFLAGS) $(GRUEL_INCLUDES) $(WITH_INCLUDES)
+AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) $(GRUEL_INCLUDES) $(WITH_INCLUDES)
 
 lib_LTLIBRARIES = libgruel.la
 
 # These are the source files that go into the gruel shared library
 libgruel_la_SOURCES = \
-       realtime.cc
+       realtime.cc \
+       thread_body_wrapper.cc
 
 # magic flags
 libgruel_la_LDFLAGS = $(NO_UNDEFINED)

Added: 
gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/thread_body_wrapper.cc
===================================================================
--- 
gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/thread_body_wrapper.cc  
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/sched-wip/gruel/src/lib/thread_body_wrapper.cc  
    2008-07-01 07:04:14 UTC (rev 8764)
@@ -0,0 +1,85 @@
+/* -*- 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 <gruel/thread_body_wrapper.h>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <stdio.h>
+
+namespace gruel {
+
+#if defined(HAVE_PTHREAD_SIGMASK) && defined(HAVE_SIGNAL_H)
+
+  void mask_signals()
+  {
+    sigset_t   new_set;
+    int r;
+
+    sigemptyset(&new_set);             
+    sigaddset(&new_set, SIGHUP);       // block these...
+    sigaddset(&new_set, SIGINT);
+    sigaddset(&new_set, SIGPIPE);
+    sigaddset(&new_set, SIGALRM);
+    sigaddset(&new_set, SIGTERM);
+    sigaddset(&new_set, SIGUSR1);
+    sigaddset(&new_set, SIGCHLD);
+#ifdef SIGPOLL
+    sigaddset(&new_set, SIGPOLL);
+#endif
+#ifdef SIGPROF
+    sigaddset(&new_set, SIGPROF);
+#endif
+#ifdef SIGSYS
+    sigaddset(&new_set, SIGSYS);
+#endif
+#ifdef SIGTRAP
+    sigaddset(&new_set, SIGTRAP);
+#endif
+#ifdef SIGURG
+    sigaddset(&new_set, SIGURG);
+#endif
+#ifdef SIGVTALRM
+    sigaddset(&new_set, SIGVTALRM);
+#endif
+#ifdef SIGXCPU
+    sigaddset(&new_set, SIGXCPU);
+#endif
+#ifdef SIGXFSZ
+    sigaddset(&new_set, SIGXFSZ);
+#endif
+    r = pthread_sigmask(SIG_BLOCK, &new_set, 0);
+    if (r != 0)
+      perror("pthread_sigmask");
+  }
+
+#else
+
+  void mask_signals()
+  {
+  }
+
+#endif
+
+};


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

Modified: gnuradio/branches/developers/eb/sched-wip/mblock/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/mblock/src/lib/Makefile.am        
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/mblock/src/lib/Makefile.am        
2008-07-01 07:04:14 UTC (rev 8764)
@@ -22,7 +22,7 @@
 include $(top_srcdir)/Makefile.common
 
 AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) \
-       $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
+       $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
 
 # disable test until we fix ticket:180
 # TESTS = test_mblock

Modified: gnuradio/branches/developers/eb/sched-wip/pmt/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/pmt/src/lib/Makefile.am   
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/pmt/src/lib/Makefile.am   
2008-07-01 07:04:14 UTC (rev 8764)
@@ -21,7 +21,7 @@
 
 include $(top_srcdir)/Makefile.common
 
-AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(BOOST_CFLAGS) \
+AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(BOOST_CPPFLAGS) \
        $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
 
 TESTS = test_pmt

Modified: gnuradio/branches/developers/eb/sched-wip/usrp/host/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/usrp/host/apps/Makefile.am        
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/usrp/host/apps/Makefile.am        
2008-07-01 07:04:14 UTC (rev 8764)
@@ -21,7 +21,7 @@
 
 include $(top_srcdir)/Makefile.common
 
-AM_CPPFLAGS = $(USRP_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) \
+AM_CPPFLAGS = $(USRP_INCLUDES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) \
           $(WITH_INCLUDES)
 
 bin_PROGRAMS =                         \

Modified: 
gnuradio/branches/developers/eb/sched-wip/usrp/host/apps-inband/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/usrp/host/apps-inband/Makefile.am 
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/usrp/host/apps-inband/Makefile.am 
2008-07-01 07:04:14 UTC (rev 8764)
@@ -23,7 +23,7 @@
 
 AM_CPPFLAGS =  \
        $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \
-       $(USRP_INCLUDES) $(USRP_INBAND_INCLUDES) $(BOOST_CFLAGS) \
+       $(USRP_INCLUDES) $(USRP_INBAND_INCLUDES) $(BOOST_CPPFLAGS) \
        $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
 
 

Modified: 
gnuradio/branches/developers/eb/sched-wip/usrp/host/lib/inband/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/sched-wip/usrp/host/lib/inband/Makefile.am  
2008-07-01 06:20:01 UTC (rev 8763)
+++ gnuradio/branches/developers/eb/sched-wip/usrp/host/lib/inband/Makefile.am  
2008-07-01 07:04:14 UTC (rev 8764)
@@ -22,7 +22,7 @@
 
 AM_CPPFLAGS =  \
        $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \
-       $(USRP_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) \
+       $(USRP_INCLUDES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) \
        -I$(srcdir)/../../apps-inband $(WITH_INCLUDES)
 
 TESTS = test_inband





reply via email to

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