GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
thread_group.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright (C) 2001-2003 William E. Kempf
4 * Copyright (C) 2007 Anthony Williams
5 * Copyright 2008,2009 Free Software Foundation, Inc.
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 */
10
11/*
12 * This was extracted from Boost 1.35.0 and fixed.
13 */
14
15#ifndef INCLUDED_THREAD_GROUP_H
16#define INCLUDED_THREAD_GROUP_H
17
18#include <gnuradio/api.h>
20#include <shared_mutex>
21#include <functional>
22#include <memory>
23
24namespace gr {
25namespace thread {
26
28{
29public:
32 thread_group(const thread_group&) = delete;
34
35 boost::thread* create_thread(const std::function<void()>& threadfunc);
36 void add_thread(std::unique_ptr<boost::thread> thrd);
38 void join_all();
40 size_t size() const;
41
42private:
43 std::list<std::unique_ptr<boost::thread>> m_threads;
44 mutable std::shared_mutex m_mutex;
45};
46
47} /* namespace thread */
48} /* namespace gr */
49
50#endif /* INCLUDED_THREAD_GROUP_H */
Definition: thread_group.h:28
thread_group & operator=(const thread_group &)=delete
thread_group(const thread_group &)=delete
void remove_thread(boost::thread *thrd)
boost::thread * create_thread(const std::function< void()> &threadfunc)
void add_thread(std::unique_ptr< boost::thread > thrd)
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
boost::thread thread
Definition: thread.h:36
GNU Radio logging wrapper.
Definition: basic_block.h:29