blob: 425858636f5a6f9ae94a8b3a79dbdd639178eef3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* -*- 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/core/noncopyable.hpp>
#include <boost/function.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <memory>
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(std::unique_ptr<boost::thread> thrd);
void remove_thread(boost::thread* thrd);
void join_all();
void interrupt_all();
size_t size() const;
private:
std::list<std::unique_ptr<boost::thread>> m_threads;
mutable boost::shared_mutex m_mutex;
};
} /* namespace thread */
} /* namespace gr */
#endif /* INCLUDED_THREAD_GROUP_H */
|