GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_GR_TPB_DETAIL_H
12 #define INCLUDED_GR_TPB_DETAIL_H
13 
14 #include <gnuradio/api.h>
15 #include <gnuradio/thread/thread.h>
16 #include <pmt/pmt.h>
17 #include <deque>
18 
19 namespace gr {
20 
21 class block_detail;
22 
23 /*!
24  * \brief used by thread-per-block scheduler
25  */
27  gr::thread::mutex mutex; //< protects all vars
32 
33 public:
34  tpb_detail() : input_changed(false), output_changed(false) {}
35 
36  //! Called by us to tell all our upstream blocks that their output
37  //! may have changed.
39 
40  //! Called by us to tell all our downstream blocks that their
41  //! input may have changed.
43 
44  //! Called by us to notify both upstream and downstream
46 
47  //! Called by pmt msg posters
48  void notify_msg()
49  {
51  input_changed = true;
52  input_cond.notify_one();
53  output_changed = true;
54  output_cond.notify_one();
55  }
56 
57  //! Called by us
59  {
61  input_changed = false;
62  output_changed = false;
63  }
64 
65 private:
66  //! Used by notify_downstream
67  void set_input_changed()
68  {
70  input_changed = true;
71  input_cond.notify_one();
72  }
73 
74  //! Used by notify_upstream
75  void set_output_changed()
76  {
78  output_changed = true;
79  output_cond.notify_one();
80  }
81 };
82 
83 } /* namespace gr */
84 
85 #endif /* INCLUDED_GR_TPB_DETAIL_H */
Implementation details to support the signal processing abstraction.
Definition: block_detail.h:36
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
boost::mutex mutex
Definition: thread.h:37
boost::unique_lock< boost::mutex > scoped_lock
Definition: thread.h:38
boost::condition_variable condition_variable
Definition: thread.h:39
GNU Radio logging wrapper.
Definition: basic_block.h:29
used by thread-per-block scheduler
Definition: tpb_detail.h:26
tpb_detail()
Definition: tpb_detail.h:34
void notify_downstream(block_detail *d)
Called by us to tell all our downstream blocks that their input may have changed.
void clear_changed()
Called by us.
Definition: tpb_detail.h:58
void notify_neighbors(block_detail *d)
Called by us to notify both upstream and downstream.
gr::thread::mutex mutex
Definition: tpb_detail.h:27
bool output_changed
Definition: tpb_detail.h:30
gr::thread::condition_variable input_cond
Definition: tpb_detail.h:29
bool input_changed
Definition: tpb_detail.h:28
void notify_upstream(block_detail *d)
Called by us to tell all our upstream blocks that their output may have changed.
void notify_msg()
Called by pmt msg posters.
Definition: tpb_detail.h:48
gr::thread::condition_variable output_cond
Definition: tpb_detail.h:31