GNU Radio 3.7.2.1 C++ API
tpb_detail.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2008,2009,2013 Free Software Foundation, Inc.
4
*
5
* This file is part of GNU Radio
6
*
7
* GNU Radio is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3, or (at your option)
10
* any later version.
11
*
12
* GNU Radio is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License along
18
* with this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
*/
21
22
#ifndef INCLUDED_GR_TPB_DETAIL_H
23
#define INCLUDED_GR_TPB_DETAIL_H
24
25
#include <
gnuradio/api.h
>
26
#include <
gnuradio/thread/thread.h
>
27
#include <deque>
28
#include <
pmt/pmt.h
>
29
30
namespace
gr {
31
32
class
block_detail;
33
34
/*!
35
* \brief used by thread-per-block scheduler
36
*/
37
struct
GR_RUNTIME_API
tpb_detail
{
38
gr::thread::mutex
mutex
;
//< protects all vars
39
bool
input_changed
;
40
gr::thread::condition_variable
input_cond
;
41
bool
output_changed
;
42
gr::thread::condition_variable
output_cond
;
43
44
public
:
45
tpb_detail
()
46
: input_changed(
false
), output_changed(
false
) { }
47
48
//! Called by us to tell all our upstream blocks that their output
49
//! may have changed.
50
void
notify_upstream(
block_detail
*d);
51
52
//! Called by us to tell all our downstream blocks that their
53
//! input may have changed.
54
void
notify_downstream(
block_detail
*d);
55
56
//! Called by us to notify both upstream and downstream
57
void
notify_neighbors(
block_detail
*d);
58
59
//! Called by pmt msg posters
60
void
notify_msg
() {
61
input_cond.notify_one();
62
output_cond.notify_one();
63
}
64
65
//! Called by us
66
void
clear_changed()
67
{
68
gr::thread::scoped_lock
guard(
mutex
);
69
input_changed =
false
;
70
output_changed =
false
;
71
}
72
73
private
:
74
//! Used by notify_downstream
75
void
set_input_changed()
76
{
77
gr::thread::scoped_lock
guard(
mutex
);
78
input_changed =
true
;
79
input_cond.notify_one();
80
}
81
82
//! Used by notify_upstream
83
void
set_output_changed()
84
{
85
gr::thread::scoped_lock
guard(
mutex
);
86
output_changed =
true
;
87
output_cond.notify_one();
88
}
89
};
90
91
}
/* namespace gr */
92
93
#endif
/* INCLUDED_GR_TPB_DETAIL_H */
gnuradio
gnuradio-runtime
include
gnuradio
tpb_detail.h
Generated by
1.8.3.1