GNU Radio 3.5.1 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/api.h> 00019 #include <gruel/thread.h> 00020 #include <boost/utility.hpp> 00021 #include <boost/thread/shared_mutex.hpp> 00022 #include <boost/function.hpp> 00023 00024 namespace gruel 00025 { 00026 class GRUEL_API thread_group : public boost::noncopyable 00027 { 00028 public: 00029 thread_group(); 00030 ~thread_group(); 00031 00032 boost::thread* create_thread(const boost::function0<void>& threadfunc); 00033 void add_thread(boost::thread* thrd); 00034 void remove_thread(boost::thread* thrd); 00035 void join_all(); 00036 void interrupt_all(); 00037 size_t size() const; 00038 00039 private: 00040 std::list<boost::thread*> m_threads; 00041 mutable boost::shared_mutex m_mutex; 00042 }; 00043 } 00044 00045 #endif /* INCLUDED_GRUEL_THREAD_GROUP_H */