File: continue_receiver_cls.htm

package info (click to toggle)
tbb 4.2~20140122-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,492 kB
  • ctags: 21,278
  • sloc: cpp: 92,813; ansic: 9,775; asm: 1,070; makefile: 1,057; sh: 351; java: 226; objc: 98; pascal: 71; xml: 41
file content (257 lines) | stat: -rwxr-xr-x 9,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns:MSHelp="http://www.microsoft.com/MSHelp/" lang="en-us" xml:lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="DC.Type" content="reference">
<meta name="DC.Title" content="continue_receiver Class">
<meta name="DC.subject" content="continue_receiver Class">
<meta name="keywords" content="continue_receiver Class">
<meta name="DC.Relation" scheme="URI" content="../../reference/flow_graph.htm">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="continue_receiver_cls">
<meta name="DC.Language" content="en-US">
<link rel="stylesheet" type="text/css" href="../../intel_css_styles.css">
<title>continue_receiver Class</title>
</head>
<body id="continue_receiver_cls">
 <!-- ==============(Start:NavScript)================= -->
 <script src="..\..\NavScript.js" language="JavaScript1.2" type="text/javascript"></script>
 <script language="JavaScript1.2" type="text/javascript">WriteNavLink(2);</script>
 <!-- ==============(End:NavScript)================= -->
<a name="continue_receiver_cls"><!-- --></a>

 
  <h1 class="topictitle1">continue_receiver Class</h1>
 
   
  <div> 
	 <div class="section"><h2 class="sectiontitle">Summary</h2> 
		 
		<p>An abstract base class for nodes that act as receivers of 
		  <span class="keyword">continue_msg</span> objects. These nodes call a method 
		  <span class="keyword">execute</span> when the number of 
		  <span class="keyword">try_put</span> calls reaches a threshold that represents
		  the number of known predecessors. 
		</p>
 
	 </div>
 
	 <div class="section"><h2 class="sectiontitle">Syntax</h2> 
		 
		<pre>class continue_receiver;</pre> 
	 </div>
 
	 <div class="section"><h2 class="sectiontitle">Header</h2> 
		 
		<pre>#include "tbb/flow_graph.h"</pre> 
	 </div>
 
	 <div class="section"><h2 class="sectiontitle">Description</h2> 
		 
		<p>This type of node is triggered when its method 
		  <span class="keyword">try_put</span> has been called a number of times that is
		  equal to the number of known predecessors. When triggered, the node calls the
		  method 
		  <span class="keyword">execute,</span> then resets and will fire again when it
		  receives the correct number of 
		  <span class="keyword">try_put</span> calls. This node type is useful for
		  dependency graphs, where each node must wait for its predecessors to complete
		  before executing, but no explicit data is passed across the edge. 
		</p>
 
	 </div>
 
	 <div class="section"><h2 class="sectiontitle">Members</h2> 
		 
		<pre>namespace tbb {
namespace flow {
 
class continue_receiver : public receiver&lt; continue_msg &gt; {
public:
    typedef continue_msg input_type;
    typedef sender&lt; input_type &gt; predecessor_type;
    continue_receiver( int num_predecessors = 0 );
    continue_receiver( const continue_receiver &amp;src );
    virtual ~continue_receiver();
    virtual bool try_put( const input_type &amp;v );
    virtual bool register_predecessor( predecessor_type &amp;p );
    virtual bool remove_predecessor( predecessor_type &amp;p );
 
protected:
    virtual void execute() = 0;
};
 
}
}</pre> 
		
<div class="tablenoborder"><table cellpadding="4" summary="" frame="border" border="1" cellspacing="0" rules="all"><span class="tabledesc">The following table provides additional information on the
			 members of this class. 
		  </span><thead align="left"> 
				<tr> 
				  <th class="cellrowborder" valign="top" width="33.89830508474576%" id="d68500e131">Member 
				  </th>
 
				  <th class="cellrowborder" valign="top" width="66.10169491525423%" id="d68500e134">Description 
				  </th>
 
				</tr>
</thead>
 
			 <tbody> 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">continue_receiver( int
						num_predecessors = 0 )</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>Constructs a 
						<span class="keyword">continue_receiver</span> that is initialized to
						trigger after receiving 
						<span class="keyword">num_predecessors</span> calls to 
						<span class="keyword">try_put</span>. 
					 </p>
 
				  </td>
 
				</tr>
 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">continue_receiver( const
						continue_receiver &amp;src )</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>Constructs a 
						<span class="keyword">continue_receiver</span> that has the same
						initial state that 
						<span class="keyword">src</span> had after its construction. It does
						not copy the current count of 
						<span class="keyword">try_puts</span> received, or the current known
						number of predecessors. The 
						<span class="keyword">continue_receiver</span> that is constructed will
						only have a non-zero threshold if 
						<span class="keyword">src</span> was constructed with a non-zero
						threshold. 
					 </p>
 
				  </td>
 
				</tr>
 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">~continue_receiver( )</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>The destructor 
					 </p>
 
				  </td>
 
				</tr>
 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">bool try_put( const input_type
						&amp;v )</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>Increments the count of 
						<span class="keyword">try_put</span> calls received. If the incremented
						count is equal to the number of known predecessors, a call is made to 
						<span class="keyword">execute</span> and the internal count of 
						<span class="keyword">try_put</span> calls is reset to zero. This
						method performs as if the call to 
						<span class="keyword">execute</span> and the updates to the internal
						count occur atomically. 
					 </p>

					 <p><strong>Returns</strong>: 
						<span class="keyword">true</span> 
					 </p>
 
				  </td>
 
				</tr>
 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">bool register_predecessor(
						predecessor_type &amp;p )</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>Increments the number of known predecessors. 
					 </p>
 
					 <p><strong>Returns</strong>: 
						<span class="keyword">true</span> 
					 </p>
 
				  </td>
 
				</tr>
 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">bool remove_predecessor(
						predecessor_type &amp;p )</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>Decrements the number of known predecessors. 
					 </p>
 
					 <div class="Note"><h3 class="NoteTipHead">
					Caution</h3> 
						<p> The method 
						  <span class="keyword">execute</span> is not called if the count of 
						  <span class="keyword">try_put</span> calls received becomes equal to
						  the number of known predecessors as a result of this call. That is, a call to 
						  <span class="keyword">remove_predecessor</span> will never call 
						  <span class="keyword">execute</span>. 
						</p>
 
					 </div> 
				  </td>
 
				</tr>
 
				<tr> 
				  <td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d68500e131 "><span class="keyword">void execute() = 0</span> 
				  </td>
 
				  <td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d68500e134 "> 
					 <p>A pure virtual method that is called when the number of 
						<span class="keyword">try_put</span> calls is equal to the number of
						known predecessors. Must be overridden by the child class. 
					 </p>
 
					 <div class="Note"><h3 class="NoteTipHead">
					Caution</h3> 
						<p> This method should be very fast or else spawn a task to
						  offload its work, since this method is called while the sender is blocked on 
						  <span class="keyword">try_put</span>. 
						</p>
 
					 </div> 
				  </td>
 
				</tr>
 
			 </tbody>
 
		  </table>
</div>
 
	 </div>
 
  </div>


<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong>&nbsp;<a href="../../reference/flow_graph.htm">Flow Graph</a></div>
</div>
<div></div>

</body>
</html>