GNU Radio C++ API Reference  gcd20ee2
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 
18 namespace gr {
19 
20 class block_detail;
21 
22 /*!
23  * \brief used by thread-per-block scheduler
24  */
26  gr::thread::mutex mutex; //< protects all vars
31 
32 public:
33  tpb_detail() : input_changed(false), output_changed(false) {}
34 
35  //! Called by us to tell all our upstream blocks that their output
36  //! may have changed.
38 
39  //! Called by us to tell all our downstream blocks that their
40  //! input may have changed.
42 
43  //! Called by us to notify both upstream and downstream
45 
46  //! Called by pmt msg posters
47  void notify_msg()
48  {
50  input_changed = true;
51  input_cond.notify_one();
52  output_changed = true;
53  output_cond.notify_one();
54  }
55 
56  //! Called by us
58  {
60  input_changed = false;
61  output_changed = false;
62  }
63 
64 private:
65  //! Used by notify_downstream
66  void set_input_changed()
67  {
69  input_changed = true;
70  input_cond.notify_one();
71  }
72 
73  //! Used by notify_upstream
74  void set_output_changed()
75  {
77  output_changed = true;
78  output_cond.notify_one();
79  }
80 };
81 
82 } /* namespace gr */
83 
84 #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:34
boost::unique_lock< boost::mutex > scoped_lock
Definition: thread.h:35
boost::condition_variable condition_variable
Definition: thread.h:36
GNU Radio logging wrapper.
Definition: basic_block.h:29
used by thread-per-block scheduler
Definition: tpb_detail.h:25
tpb_detail()
Definition: tpb_detail.h:33
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:57
void notify_neighbors(block_detail *d)
Called by us to notify both upstream and downstream.
gr::thread::mutex mutex
Definition: tpb_detail.h:26
bool output_changed
Definition: tpb_detail.h:29
gr::thread::condition_variable input_cond
Definition: tpb_detail.h:28
bool input_changed
Definition: tpb_detail.h:27
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:47
gr::thread::condition_variable output_cond
Definition: tpb_detail.h:30