summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2013-05-02 12:41:28 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2013-05-02 12:41:28 -0700
commit4209a466dbaf45a0c84474b186d269afbddec0f5 (patch)
treeceabbd3678662b0e3d5c4cb61990012d7398992f
parent3a2bb59d93bbdf272f387898beed5e5d6d965afd (diff)
runtime: remove dead select_handler and dispatcher
-rw-r--r--gnuradio-runtime/include/gnuradio/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/include/gnuradio/dispatcher.h73
-rw-r--r--gnuradio-runtime/include/gnuradio/select_handler.h90
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/lib/dispatcher.cc195
-rw-r--r--gnuradio-runtime/lib/select_handler.cc40
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/swig/dispatcher.i56
-rw-r--r--gnuradio-runtime/swig/runtime_swig.i2
9 files changed, 0 insertions, 461 deletions
diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt
index 2b0ab4a062..3ea0da4806 100644
--- a/gnuradio-runtime/include/gnuradio/CMakeLists.txt
+++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt
@@ -33,7 +33,6 @@ install(FILES
block_registry.h
buffer.h
constants.h
- dispatcher.h
endianness.h
error_handler.h
expj.h
@@ -65,7 +64,6 @@ install(FILES
tagged_stream_block.h
top_block.h
tpb_detail.h
- select_handler.h
sincos.h
sptr_magic.h
sync_block.h
diff --git a/gnuradio-runtime/include/gnuradio/dispatcher.h b/gnuradio-runtime/include/gnuradio/dispatcher.h
deleted file mode 100644
index ab1d6190c6..0000000000
--- a/gnuradio-runtime/include/gnuradio/dispatcher.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_DISPATCHER_H
-#define INCLUDED_GR_DISPATCHER_H
-
-#include <gnuradio/api.h>
-#include <gnuradio/select_handler.h>
-#include <vector>
-
-namespace gr {
-
- class dispatcher;
- typedef boost::shared_ptr<dispatcher> dispatcher_sptr;
-
- GR_RUNTIME_API dispatcher_sptr dispatcher_singleton();
- GR_RUNTIME_API dispatcher_sptr make_dispatcher();
-
- /*!
- * \brief invoke callbacks based on select.
- * \ingroup internal
- *
- * \sa gr_select_handler
- */
- class GR_RUNTIME_API dispatcher
- {
- dispatcher();
- friend GR_RUNTIME_API dispatcher_sptr make_dispatcher();
-
- std::vector<select_handler_sptr> d_handler;
- int d_max_index;
-
- public:
- ~dispatcher();
-
- bool add_handler(select_handler_sptr handler);
- bool del_handler(select_handler_sptr handler);
- bool del_handler(select_handler *handler);
-
- /*!
- * \brief Event dispatching loop.
- *
- * Enter a polling loop that only terminates after all
- * gr::select_handlers have been removed. \p timeout sets the
- * timeout parameter to the select() call, measured in seconds.
- *
- * \param timeout maximum number of seconds to block in select.
- */
- void loop(double timeout=10);
- };
-
-} /* namespace gr */
-
-#endif /* INCLUDED_GR_DISPATCHER_H */
diff --git a/gnuradio-runtime/include/gnuradio/select_handler.h b/gnuradio-runtime/include/gnuradio/select_handler.h
deleted file mode 100644
index df7c753ced..0000000000
--- a/gnuradio-runtime/include/gnuradio/select_handler.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_SELECT_HANDLER_H
-#define INCLUDED_GR_SELECT_HANDLER_H
-
-#include <gnuradio/api.h>
-#include <boost/shared_ptr.hpp>
-
-namespace gr {
-
- class select_handler;
- typedef boost::shared_ptr<select_handler> select_handler_sptr;
-
- /*!
- * \brief Abstract handler for select based notification.
- * \ingroup base
- *
- * \sa gr::dispatcher
- */
- class GR_RUNTIME_API select_handler
- {
- int d_fd;
-
- protected:
- select_handler(int file_descriptor);
-
- public:
- virtual ~select_handler();
-
- int fd() const { return d_fd; }
- int file_descriptor() const { return d_fd; }
-
- /*!
- * \brief Called when file_descriptor is readable.
- *
- * Called when the dispatcher detects that file_descriptor can be
- * read without blocking.
- */
- virtual void handle_read() = 0;
-
- /*!
- * \brief Called when file_descriptor is writable.
- *
- * Called when dispatcher detects that file descriptor can be
- * written without blocking.
- */
- virtual void handle_write() = 0;
-
- /*!
- * Called each time around the dispatcher loop to determine
- * whether this handler's file descriptor should be added to the
- * list on which read events can occur. The default method
- * returns true, indicating that by default, all handlers are
- * interested in read events.
- */
- virtual bool readable() { return true; }
-
- /*!
- * Called each time around the dispatcher loop to determine
- * whether this handler's file descriptor should be added to the
- * list on which write events can occur. The default method
- * returns true, indicating that by default, all handlers are
- * interested in write events.
- */
- virtual bool writable() { return true; }
- };
-
-} /* namespace gr */
-
-#endif /* INCLUDED_GR_SELECT_HANDLER_H */
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 88ac589cb3..3206e3c224 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -79,7 +79,6 @@ list(APPEND gnuradio_runtime_sources
block_registry.cc
buffer.cc
circular_file.cc
- dispatcher.cc
feval.cc
flat_flowgraph.cc
flowgraph.cc
@@ -103,7 +102,6 @@ list(APPEND gnuradio_runtime_sources
scheduler.cc
scheduler_sts.cc
scheduler_tpb.cc
- select_handler.cc
single_threaded_scheduler.cc
sptr_magic.cc
sync_block.cc
diff --git a/gnuradio-runtime/lib/dispatcher.cc b/gnuradio-runtime/lib/dispatcher.cc
deleted file mode 100644
index 7c9e13c5a6..0000000000
--- a/gnuradio-runtime/lib/dispatcher.cc
+++ /dev/null
@@ -1,195 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnuradio/dispatcher.h>
-#include <math.h>
-#include <errno.h>
-#include <stdio.h>
-
-#ifdef HAVE_SELECT
-# ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
-# else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# endif
-# ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
-# endif
-#endif
-
-namespace gr {
-
- static dispatcher_sptr s_singleton;
-
- dispatcher_sptr
- make_dispatcher()
- {
- return dispatcher_sptr(new dispatcher());
- }
-
- dispatcher_sptr
- dispatcher_singleton()
- {
- if(s_singleton)
- return s_singleton;
-
- s_singleton = make_dispatcher();
- return s_singleton;
- }
-
-#if !defined(HAVE_SELECT) // Stub it out
-
- dispatcher::dispatcher()
- {
- }
-
- dispatcher::~dispatcher()
- {
- }
-
- bool
- dispatcher::add_handler(select_handler_sptr handler)
- {
- return true;
- }
-
- bool
- dispatcher::del_handler(select_handler_sptr handler)
- {
- return true;
- }
-
- bool
- dispatcher::del_handler(select_handler *handler)
- {
- return true;
- }
-
- void
- dispatcher::loop(double timeout)
- {
- }
-
-#else // defined(HAVE_SELECT)
-
- dispatcher::dispatcher()
- : d_handler(FD_SETSIZE), d_max_index(-1)
- {
- }
-
- dispatcher::~dispatcher()
- {
- }
-
- bool
- dispatcher::add_handler(select_handler_sptr handler)
- {
- int fd = handler->fd();
- if(fd < 0 || fd >= FD_SETSIZE)
- return false;
-
- d_max_index = std::max(d_max_index, fd);
- d_handler[fd] = handler;
- return true;
- }
-
- bool
- dispatcher::del_handler(select_handler_sptr handler)
- {
- return del_handler(handler.get());
- }
-
- bool
- dispatcher::del_handler(select_handler *handler)
- {
- int fd = handler->fd();
- if(fd < 0 || fd >= FD_SETSIZE)
- return false;
-
- d_handler[fd].reset();
-
- if(fd == d_max_index) {
- int i;
- for(i = fd - 1; i >= 0 && !d_handler[i]; i--)
- ;
- d_max_index = i;
- }
- return true;
- }
-
- void
- dispatcher::loop(double timeout)
- {
- struct timeval master;
- struct timeval tmp;
- fd_set rd_set;
- fd_set wr_set;
-
- double secs = floor (timeout);
- master.tv_sec = (long) secs;
- master.tv_usec = (long) ((timeout - secs) * 1e6);
-
- while(d_max_index >= 0) {
- FD_ZERO(&rd_set);
- FD_ZERO(&wr_set);
-
- for(int i = 0; i <= d_max_index; i++) {
- if(d_handler[i] && d_handler[i]->readable())
- FD_SET(i, &rd_set);
- if(d_handler[i] && d_handler[i]->writable())
- FD_SET(i, &wr_set);
- }
-
- tmp = master;
- int retval = select(d_max_index+1, &rd_set, &wr_set, 0, &tmp);
- if(retval == 0) // timed out with nothing ready
- continue;
- if(retval < 0) {
- if(errno == EINTR)
- continue;
- perror("gr_dispatcher/select");
- return;
- }
-
- for(int i = 0; i <= d_max_index; i++) {
- if(FD_ISSET(i, &rd_set))
- if(d_handler[i])
- d_handler[i]->handle_read();
- if(FD_ISSET(i, &wr_set))
- if(d_handler[i])
- d_handler[i]->handle_write();
- }
- }
- }
-
-} /* namespace gr */
-
-#endif /* HAVE_SELECT */
diff --git a/gnuradio-runtime/lib/select_handler.cc b/gnuradio-runtime/lib/select_handler.cc
deleted file mode 100644
index ca99ce6ce8..0000000000
--- a/gnuradio-runtime/lib/select_handler.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnuradio/select_handler.h>
-
-namespace gr {
-
- select_handler::select_handler(int fd)
- : d_fd(fd)
- {
- }
-
- select_handler::~select_handler()
- {
- }
-
-} /* namespace gr */
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
index 1900f4094e..f6f63b4384 100644
--- a/gnuradio-runtime/swig/CMakeLists.txt
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -99,7 +99,6 @@ install(
buffer.i
complex_vec_test.i
constants.i
- dispatcher.i
feval.i
gnuradio.i
gr_ctrlport.i
diff --git a/gnuradio-runtime/swig/dispatcher.i b/gnuradio-runtime/swig/dispatcher.i
deleted file mode 100644
index 4a039c61e3..0000000000
--- a/gnuradio-runtime/swig/dispatcher.i
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-class gr::dispatcher;
-typedef boost::shared_ptr<gr::dispatcher> gr::dispatcher_sptr;
-%template(dispatcher_sptr) boost::shared_ptr<gr::dispatcher>;
-
-%rename(dispatcher) gr::make_dispatcher;
-gr::dispatcher_sptr gr::make_dispatcher();
-
-%rename(dispatcher_singleton) gr::dispatcher_singleton;
-gr::dispatcher_sptr gr::dispatcher_singleton();
-
-/*!
- * \brief invoke callbacks based on select.
- *
- * \sa gr::select_handler
- */
-class gr::dispatcher
-{
- dispatcher();
-
-public:
- ~dispatcher();
-
- /*!
- * \brief Event dispatching loop.
- *
- * Enter a polling loop that only terminates after all gr::select_handlers
- * have been removed. \p timeout sets the timeout parameter to the select()
- * call, measured in seconds.
- *
- * \param timeout maximum number of seconds to block in select.
- */
- void loop(double timeout=10);
-};
-
diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i
index 1e32c086a2..a358976a46 100644
--- a/gnuradio-runtime/swig/runtime_swig.i
+++ b/gnuradio-runtime/swig/runtime_swig.i
@@ -43,7 +43,6 @@
#include <gnuradio/block_detail.h>
#include <gnuradio/buffer.h>
#include <gnuradio/constants.h>
-#include <gnuradio/dispatcher.h>
#include <gnuradio/endianness.h>
#include <gnuradio/feval.h>
#include <gnuradio/hier_block2.h>
@@ -75,7 +74,6 @@
%include "block_detail.i"
%include "buffer.i"
%include "constants.i"
-%include "dispatcher.i"
%include "feval.i"
%include "hier_block2.i"
%include "io_signature.i"