summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/include/gnuradio/thread/thread_group.h
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-04-17 13:43:52 -0400
committerTom Rondeau <trondeau@vt.edu>2013-04-29 14:52:56 -0400
commitf3e2e07201c50033bf6c9d0c6a6f068557b4f17f (patch)
tree140b3c2d20a951ffd4abd564c3378ee2e2f9fc7c /gnuradio-runtime/include/gnuradio/thread/thread_group.h
parent35303ae975a5b1bdecc2492bc96e2b8e89b62a3d (diff)
runtime: converting runtime core to gr namespace, gnuradio include dir.
Diffstat (limited to 'gnuradio-runtime/include/gnuradio/thread/thread_group.h')
-rw-r--r--gnuradio-runtime/include/gnuradio/thread/thread_group.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/gnuradio-runtime/include/gnuradio/thread/thread_group.h b/gnuradio-runtime/include/gnuradio/thread/thread_group.h
new file mode 100644
index 0000000000..830017d11e
--- /dev/null
+++ b/gnuradio-runtime/include/gnuradio/thread/thread_group.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright (C) 2001-2003 William E. Kempf
+ * Copyright (C) 2007 Anthony Williams
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+/*
+ * This was extracted from Boost 1.35.0 and fixed.
+ */
+
+#ifndef INCLUDED_THREAD_GROUP_H
+#define INCLUDED_THREAD_GROUP_H
+
+#include <gnuradio/api.h>
+#include <gnuradio/thread/thread.h>
+#include <boost/utility.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/function.hpp>
+
+namespace gr {
+ namespace thread {
+
+ class GR_RUNTIME_API thread_group : public boost::noncopyable
+ {
+ public:
+ thread_group();
+ ~thread_group();
+
+ boost::thread* create_thread(const boost::function0<void>& threadfunc);
+ void add_thread(boost::thread* thrd);
+ void remove_thread(boost::thread* thrd);
+ void join_all();
+ void interrupt_all();
+ size_t size() const;
+
+ private:
+ std::list<boost::thread*> m_threads;
+ mutable boost::shared_mutex m_mutex;
+ };
+
+ } /* namespace thread */
+} /* namespace gr */
+
+#endif /* INCLUDED_THREAD_GROUP_H */