GNU Radio 3.4.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright (C) 2001-2003 William E. Kempf 00004 * Copyright (C) 2007 Anthony Williams 00005 * Copyright 2008,2009 Free Software Foundation, Inc. 00006 * 00007 * Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 */ 00010 00011 /* 00012 * This was extracted from Boost 1.35.0 and fixed. 00013 */ 00014 00015 #ifndef INCLUDED_GRUEL_THREAD_GROUP_H 00016 #define INCLUDED_GRUEL_THREAD_GROUP_H 00017 00018 #include <gruel/thread.h> 00019 #include <boost/utility.hpp> 00020 #include <boost/thread/shared_mutex.hpp> 00021 #include <boost/function.hpp> 00022 00023 namespace gruel 00024 { 00025 class thread_group : public boost::noncopyable 00026 { 00027 public: 00028 thread_group(); 00029 ~thread_group(); 00030 00031 boost::thread* create_thread(const boost::function0<void>& threadfunc); 00032 void add_thread(boost::thread* thrd); 00033 void remove_thread(boost::thread* thrd); 00034 void join_all(); 00035 void interrupt_all(); 00036 size_t size() const; 00037 00038 private: 00039 std::list<boost::thread*> m_threads; 00040 mutable boost::shared_mutex m_mutex; 00041 }; 00042 } 00043 00044 #endif /* INCLUDED_GRUEL_THREAD_GROUP_H */