GNU Radio C++ API Reference
3.10.12.0
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
* Copyright 2023 Marcus Müller
7
*
8
* Distributed under the Boost Software License, Version 1.0. (See accompanying
9
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10
*/
11
12
/*
13
* This was extracted from Boost 1.35.0 and fixed.
14
*/
15
16
#ifndef INCLUDED_THREAD_GROUP_H
17
#define INCLUDED_THREAD_GROUP_H
18
19
#include <
gnuradio/api.h
>
20
#include <
gnuradio/thread/thread.h
>
21
22
#include <shared_mutex>
23
#include <unordered_set>
24
#include <functional>
25
#include <memory>
26
27
namespace
gr
{
28
namespace
thread
{
29
30
class
GR_RUNTIME_API
thread_group
31
{
32
public
:
33
thread_group
() =
default
;
34
~thread_group
() =
default
;
35
thread_group
(
const
thread_group
&) =
delete
;
36
thread_group
&
operator=
(
const
thread_group
&) =
delete
;
37
38
boost::thread
*
create_thread
(
const
std::function<
void
()>& threadfunc);
39
void
add_thread
(std::unique_ptr<boost::thread> thrd) noexcept;
40
void
remove_thread
(
boost::thread
* thrd) noexcept;
41
void
join_all
();
42
void
interrupt_all
();
43
size_t
size
() const noexcept;
44
45
private:
46
std::unordered_set<std::unique_ptr<boost::
thread
>> m_threads;
47
mutable std::shared_mutex m_mutex;
48
};
49
50
}
/* namespace thread */
51
}
/* namespace gr */
52
53
#endif
/* INCLUDED_THREAD_GROUP_H */
gr::thread::thread_group::add_thread
void add_thread(std::unique_ptr< boost::thread > thrd) noexcept
gr::thread::thread_group::thread_group
thread_group(const thread_group &)=delete
gr::thread::thread_group::thread_group
thread_group()=default
gr::thread::thread_group::join_all
void join_all()
gr::thread::thread_group
Definition:
thread_group.h:31
gr::thread::thread_group::interrupt_all
void interrupt_all()
gr::thread::thread_group::create_thread
boost::thread * create_thread(const std::function< void()> &threadfunc)
GR_RUNTIME_API
#define GR_RUNTIME_API
Definition:
gnuradio-runtime/include/gnuradio/api.h:18
gr::thread::thread_group::~thread_group
~thread_group()=default
gr::thread::thread_group::remove_thread
void remove_thread(boost::thread *thrd) noexcept
api.h
gr::thread::thread
boost::thread thread
Definition:
thread.h:36
gr::thread::thread_group::size
size_t size() const noexcept
gr
GNU Radio logging wrapper.
Definition:
basic_block.h:29
thread.h
gr::thread::thread_group::operator=
thread_group & operator=(const thread_group &)=delete
gnuradio-runtime
include
gnuradio
thread
thread_group.h
Generated by
1.8.20