slave 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +16 -0
- data/doc/classes/Slave/Heartbeat.html +241 -126
- data/doc/classes/Slave.html +289 -173
- data/doc/created.rid +1 -1
- data/doc/dot/f_1.dot +16 -1
- data/doc/dot/f_1.jpg +0 -0
- data/doc/files/README.html +1 -1
- data/doc/files/lib/slave_rb.html +3 -2
- data/doc/fr_file_index.html +0 -1
- data/doc/fr_method_index.html +16 -10
- data/lib/{slave-0.0.0.rb → slave-0.0.1.rb} +102 -8
- data/lib/slave.rb +130 -19
- data/rdoc.cmd +1 -1
- data/sample/a.rb +11 -94
- data/sample/b.rb +8 -0
- data/sample/c.rb +109 -0
- data/{slave-0.0.0.gem → slave-0.0.1.gem} +0 -0
- metadata +24 -22
- data/VERSION +0 -1
data/HISTORY
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
0.0.1:
|
4
|
+
- patch from Logan Capaldo adds block form to slave new, block is run in the
|
5
|
+
child
|
6
|
+
|
7
|
+
- added a few more samples/*
|
8
|
+
|
9
|
+
- added Slave#wait
|
10
|
+
|
11
|
+
- added status information to slaves
|
12
|
+
|
13
|
+
- added close-on-exec flag to pipes in parent process
|
14
|
+
|
15
|
+
0.0.0:
|
16
|
+
- initial version
|
@@ -77,7 +77,7 @@
|
|
77
77
|
<map name="map">
|
78
78
|
<area shape="RECT" coords="28,88,99,40" href="../Slave.html" alt="Slave">
|
79
79
|
</map>
|
80
|
-
<img src="../../dot/
|
80
|
+
<img src="../../dot/f_1.jpg" usemap="#map" border=0 alt="TopLevel">
|
81
81
|
</div>
|
82
82
|
|
83
83
|
<div id="description">
|
@@ -85,9 +85,9 @@
|
|
85
85
|
the <a href="Heartbeat.html">Heartbeat</a> class is essentially wrapper
|
86
86
|
over an IPC channel that sends a ping on the channel indicating process
|
87
87
|
health. if either end of the channel is detached the ping will fail and an
|
88
|
-
error will be raised. in this
|
89
|
-
href="../Slave.html">Slave</a>
|
90
|
-
parent being alive.
|
88
|
+
error will be raised. in this way it is ensured that <a
|
89
|
+
href="../Slave.html">Slave</a> objects cannot continue to live without
|
90
|
+
their parent being alive.
|
91
91
|
</p>
|
92
92
|
|
93
93
|
</div>
|
@@ -97,12 +97,15 @@ parent being alive.
|
|
97
97
|
<h2 class="section-bar">Methods</h2>
|
98
98
|
|
99
99
|
<div class="name-list">
|
100
|
-
<a href="#
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
100
|
+
<a href="#M000014">child_start</a>
|
101
|
+
<a href="#M000017">child_start</a>
|
102
|
+
<a href="#M000011">new</a>
|
103
|
+
<a href="#M000013">parent_start</a>
|
104
|
+
<a href="#M000016">parent_start</a>
|
105
|
+
<a href="#M000012">start</a>
|
106
|
+
<a href="#M000015">start</a>
|
107
|
+
<a href="#M000018">stop</a>
|
108
|
+
<a href="#M000019">trace</a>
|
106
109
|
</div>
|
107
110
|
</div>
|
108
111
|
|
@@ -122,36 +125,36 @@ parent being alive.
|
|
122
125
|
<div id="methods">
|
123
126
|
<h2 class="section-bar">Public Class methods</h2>
|
124
127
|
|
125
|
-
<div id="method-
|
126
|
-
<a name="
|
128
|
+
<div id="method-M000011" class="method-detail">
|
129
|
+
<a name="M000011"></a>
|
127
130
|
|
128
131
|
<div class="method-heading">
|
129
|
-
<a href="#
|
132
|
+
<a href="#M000011" class="method-signature">
|
130
133
|
<span class="method-name">new</span><span class="method-args">pulse_rate = 4.2, debug = false</span>
|
131
134
|
</a>
|
132
135
|
</div>
|
133
136
|
|
134
137
|
<div class="method-description">
|
135
138
|
<p><a class="source-toggle" href="#"
|
136
|
-
onclick="toggleCode('
|
137
|
-
<div class="method-source-code" id="
|
139
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
140
|
+
<div class="method-source-code" id="M000011-source">
|
138
141
|
<pre>
|
139
|
-
<span class="ruby-comment cmt"># File lib/slave.rb, line
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
142
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 264</span>
|
143
|
+
264: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">pulse_rate</span> = <span class="ruby-value">4.2</span>, <span class="ruby-identifier">debug</span> = <span class="ruby-keyword kw">false</span>
|
144
|
+
265: <span class="ruby-comment cmt">#--{{{</span>
|
145
|
+
266: <span class="ruby-ivar">@pulse_rate</span> = <span class="ruby-constant">Float</span> <span class="ruby-identifier">pulse_rate</span>
|
146
|
+
267: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">debug</span>
|
147
|
+
268: <span class="ruby-ivar">@r</span>, <span class="ruby-ivar">@w</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-identifier">pipe</span>
|
148
|
+
269: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
|
149
|
+
270: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
|
150
|
+
271: <span class="ruby-ivar">@cid</span> = <span class="ruby-keyword kw">nil</span>
|
151
|
+
272: <span class="ruby-ivar">@thread</span> = <span class="ruby-keyword kw">nil</span>
|
152
|
+
273: <span class="ruby-ivar">@ppid</span> = <span class="ruby-keyword kw">nil</span>
|
153
|
+
274: <span class="ruby-ivar">@whoami</span> = <span class="ruby-keyword kw">nil</span>
|
154
|
+
275: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">nil</span>
|
155
|
+
276: <span class="ruby-ivar">@pipe</span> = <span class="ruby-keyword kw">nil</span>
|
156
|
+
277: <span class="ruby-comment cmt">#--}}}</span>
|
157
|
+
278: <span class="ruby-keyword kw">end</span>
|
155
158
|
</pre>
|
156
159
|
</div>
|
157
160
|
</div>
|
@@ -159,116 +162,158 @@ parent being alive.
|
|
159
162
|
|
160
163
|
<h2 class="section-bar">Public Instance methods</h2>
|
161
164
|
|
162
|
-
<div id="method-
|
163
|
-
<a name="
|
165
|
+
<div id="method-M000014" class="method-detail">
|
166
|
+
<a name="M000014"></a>
|
164
167
|
|
165
168
|
<div class="method-heading">
|
166
|
-
<a href="#
|
169
|
+
<a href="#M000014" class="method-signature">
|
167
170
|
<span class="method-name">child_start</span><span class="method-args">()</span>
|
168
171
|
</a>
|
169
172
|
</div>
|
170
173
|
|
171
174
|
<div class="method-description">
|
172
175
|
<p><a class="source-toggle" href="#"
|
173
|
-
onclick="toggleCode('
|
174
|
-
<div class="method-source-code" id="
|
176
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
177
|
+
<div class="method-source-code" id="M000014-source">
|
175
178
|
<pre>
|
176
|
-
<span class="ruby-comment cmt"># File lib/slave.rb, line
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
179
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 313</span>
|
180
|
+
313: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">child_start</span>
|
181
|
+
314: <span class="ruby-comment cmt">#--{{{</span>
|
182
|
+
315: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'child'</span>
|
183
|
+
316: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
|
184
|
+
317: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
|
185
|
+
318: <span class="ruby-ivar">@thread</span> =
|
186
|
+
319: <span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">current</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cur</span><span class="ruby-operator">|</span>
|
187
|
+
320: <span class="ruby-keyword kw">begin</span>
|
188
|
+
321: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
189
|
+
322: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">"<#{ @whoami }> <#{ @pid }> puts <#{ @pid }>"</span> }
|
190
|
+
323: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@pid</span>
|
191
|
+
324: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">kill</span> <span class="ruby-value">0</span>, <span class="ruby-ivar">@ppid</span>
|
192
|
+
325: <span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@pulse_rate</span>
|
193
|
+
326: <span class="ruby-keyword kw">end</span>
|
194
|
+
327: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
195
|
+
328: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
196
|
+
329: <span class="ruby-keyword kw">ensure</span>
|
197
|
+
330: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
198
|
+
331: <span class="ruby-keyword kw">end</span>
|
199
|
+
332: <span class="ruby-keyword kw">end</span>
|
200
|
+
333: <span class="ruby-comment cmt">#--}}}</span>
|
201
|
+
334: <span class="ruby-keyword kw">end</span>
|
199
202
|
</pre>
|
200
203
|
</div>
|
201
204
|
</div>
|
202
205
|
</div>
|
203
206
|
|
204
|
-
<div id="method-
|
205
|
-
<a name="
|
207
|
+
<div id="method-M000017" class="method-detail">
|
208
|
+
<a name="M000017"></a>
|
206
209
|
|
207
210
|
<div class="method-heading">
|
208
|
-
<a href="#
|
211
|
+
<a href="#M000017" class="method-signature">
|
212
|
+
<span class="method-name">child_start</span><span class="method-args">()</span>
|
213
|
+
</a>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
<p><a class="source-toggle" href="#"
|
218
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
219
|
+
<div class="method-source-code" id="M000017-source">
|
220
|
+
<pre>
|
221
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 366</span>
|
222
|
+
366: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">child_start</span>
|
223
|
+
367: <span class="ruby-comment cmt">#--{{{</span>
|
224
|
+
368: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'child'</span>
|
225
|
+
369: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
|
226
|
+
370: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
|
227
|
+
371: <span class="ruby-ivar">@thread</span> =
|
228
|
+
372: <span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">current</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cur</span><span class="ruby-operator">|</span>
|
229
|
+
373: <span class="ruby-keyword kw">begin</span>
|
230
|
+
374: <span class="ruby-identifier">trace</span>{ <span class="ruby-value str">"child reading..."</span> }
|
231
|
+
375: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">read</span>
|
232
|
+
376: <span class="ruby-identifier">trace</span>{ <span class="ruby-value str">"child read."</span> }
|
233
|
+
377: <span class="ruby-identifier">trace</span>{ <span class="ruby-value str">"child exiting."</span> }
|
234
|
+
378: <span class="ruby-identifier">exit!</span>
|
235
|
+
379: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
236
|
+
380: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
237
|
+
381: <span class="ruby-keyword kw">ensure</span>
|
238
|
+
382: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
239
|
+
383: <span class="ruby-keyword kw">end</span>
|
240
|
+
384: <span class="ruby-keyword kw">end</span>
|
241
|
+
385: <span class="ruby-comment cmt">#--}}}</span>
|
242
|
+
386: <span class="ruby-keyword kw">end</span>
|
243
|
+
</pre>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
<div id="method-M000013" class="method-detail">
|
249
|
+
<a name="M000013"></a>
|
250
|
+
|
251
|
+
<div class="method-heading">
|
252
|
+
<a href="#M000013" class="method-signature">
|
209
253
|
<span class="method-name">parent_start</span><span class="method-args">()</span>
|
210
254
|
</a>
|
211
255
|
</div>
|
212
256
|
|
213
257
|
<div class="method-description">
|
214
258
|
<p><a class="source-toggle" href="#"
|
215
|
-
onclick="toggleCode('
|
216
|
-
<div class="method-source-code" id="
|
259
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
260
|
+
<div class="method-source-code" id="M000013-source">
|
217
261
|
<pre>
|
218
|
-
<span class="ruby-comment cmt"># File lib/slave.rb, line
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
262
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 294</span>
|
263
|
+
294: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parent_start</span>
|
264
|
+
295: <span class="ruby-comment cmt">#--{{{</span>
|
265
|
+
296: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'parent'</span>
|
266
|
+
297: <span class="ruby-ivar">@thread</span> =
|
267
|
+
298: <span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">current</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cur</span><span class="ruby-operator">|</span>
|
268
|
+
299: <span class="ruby-keyword kw">begin</span>
|
269
|
+
300: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
270
|
+
301: <span class="ruby-identifier">buf</span> = <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">gets</span>
|
271
|
+
302: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">"<#{ @whoami }> <#{ @pid }> gets <#{ buf.inspect }>"</span> }
|
272
|
+
303: <span class="ruby-ivar">@cid</span> = <span class="ruby-constant">Integer</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cid</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">buf</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%/^\s*\d+\s*$/</span>
|
273
|
+
304: <span class="ruby-keyword kw">end</span>
|
274
|
+
305: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
275
|
+
306: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
276
|
+
307: <span class="ruby-keyword kw">ensure</span>
|
277
|
+
308: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
278
|
+
309: <span class="ruby-keyword kw">end</span>
|
279
|
+
310: <span class="ruby-keyword kw">end</span>
|
280
|
+
311: <span class="ruby-comment cmt">#--}}}</span>
|
281
|
+
312: <span class="ruby-keyword kw">end</span>
|
238
282
|
</pre>
|
239
283
|
</div>
|
240
284
|
</div>
|
241
285
|
</div>
|
242
286
|
|
243
|
-
<div id="method-
|
244
|
-
<a name="
|
287
|
+
<div id="method-M000016" class="method-detail">
|
288
|
+
<a name="M000016"></a>
|
245
289
|
|
246
290
|
<div class="method-heading">
|
247
|
-
<a href="#
|
248
|
-
<span class="method-name">
|
291
|
+
<a href="#M000016" class="method-signature">
|
292
|
+
<span class="method-name">parent_start</span><span class="method-args">()</span>
|
249
293
|
</a>
|
250
294
|
</div>
|
251
295
|
|
252
296
|
<div class="method-description">
|
253
297
|
<p><a class="source-toggle" href="#"
|
254
|
-
onclick="toggleCode('
|
255
|
-
<div class="method-source-code" id="
|
298
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
299
|
+
<div class="method-source-code" id="M000016-source">
|
256
300
|
<pre>
|
257
|
-
<span class="ruby-comment cmt"># File lib/slave.rb, line
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
301
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 351</span>
|
302
|
+
351: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parent_start</span>
|
303
|
+
352: <span class="ruby-comment cmt">#--{{{</span>
|
304
|
+
353: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'parent'</span>
|
305
|
+
354: <span class="ruby-ivar">@thread</span> =
|
306
|
+
355: <span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">current</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cur</span><span class="ruby-operator">|</span>
|
307
|
+
356: <span class="ruby-keyword kw">begin</span>
|
308
|
+
357: <span class="ruby-identifier">sleep</span>
|
309
|
+
358: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
310
|
+
359: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
311
|
+
360: <span class="ruby-keyword kw">ensure</span>
|
312
|
+
361: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
313
|
+
362: <span class="ruby-keyword kw">end</span>
|
314
|
+
363: <span class="ruby-keyword kw">end</span>
|
315
|
+
364: <span class="ruby-comment cmt">#--}}}</span>
|
316
|
+
365: <span class="ruby-keyword kw">end</span>
|
272
317
|
</pre>
|
273
318
|
</div>
|
274
319
|
</div>
|
@@ -279,7 +324,7 @@ parent being alive.
|
|
279
324
|
|
280
325
|
<div class="method-heading">
|
281
326
|
<a href="#M000012" class="method-signature">
|
282
|
-
<span class="method-name">
|
327
|
+
<span class="method-name">start</span><span class="method-args">()</span>
|
283
328
|
</a>
|
284
329
|
</div>
|
285
330
|
|
@@ -288,40 +333,110 @@ parent being alive.
|
|
288
333
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
289
334
|
<div class="method-source-code" id="M000012-source">
|
290
335
|
<pre>
|
291
|
-
<span class="ruby-comment cmt"># File lib/slave.rb, line
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
336
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 279</span>
|
337
|
+
279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
338
|
+
280: <span class="ruby-comment cmt">#--{{{</span>
|
339
|
+
281: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@pid</span>
|
340
|
+
282: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
|
341
|
+
283: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@r</span>
|
342
|
+
284: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">fcntl</span> <span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">F_SETFD</span>, <span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">FD_CLOEXEC</span>
|
343
|
+
285: <span class="ruby-identifier">parent_start</span>
|
344
|
+
286: <span class="ruby-keyword kw">else</span>
|
345
|
+
287: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
|
346
|
+
288: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@w</span>
|
347
|
+
289: <span class="ruby-identifier">child_start</span>
|
348
|
+
290: <span class="ruby-keyword kw">end</span>
|
349
|
+
291: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">true</span>
|
350
|
+
292: <span class="ruby-comment cmt">#--}}}</span>
|
351
|
+
293: <span class="ruby-keyword kw">end</span>
|
300
352
|
</pre>
|
301
353
|
</div>
|
302
354
|
</div>
|
303
355
|
</div>
|
304
356
|
|
305
|
-
<div id="method-
|
306
|
-
<a name="
|
357
|
+
<div id="method-M000015" class="method-detail">
|
358
|
+
<a name="M000015"></a>
|
307
359
|
|
308
360
|
<div class="method-heading">
|
309
|
-
<a href="#
|
361
|
+
<a href="#M000015" class="method-signature">
|
362
|
+
<span class="method-name">start</span><span class="method-args">()</span>
|
363
|
+
</a>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
<div class="method-description">
|
367
|
+
<p><a class="source-toggle" href="#"
|
368
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
369
|
+
<div class="method-source-code" id="M000015-source">
|
370
|
+
<pre>
|
371
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 336</span>
|
372
|
+
336: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
373
|
+
337: <span class="ruby-comment cmt">#--{{{</span>
|
374
|
+
338: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@pid</span>
|
375
|
+
339: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
|
376
|
+
340: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@w</span>
|
377
|
+
341: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">fcntl</span> <span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">F_SETFD</span>, <span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">FD_CLOEXEC</span>
|
378
|
+
342: <span class="ruby-identifier">parent_start</span>
|
379
|
+
343: <span class="ruby-keyword kw">else</span>
|
380
|
+
344: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
|
381
|
+
345: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@r</span>
|
382
|
+
346: <span class="ruby-identifier">child_start</span>
|
383
|
+
347: <span class="ruby-keyword kw">end</span>
|
384
|
+
348: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">true</span>
|
385
|
+
349: <span class="ruby-comment cmt">#--}}}</span>
|
386
|
+
350: <span class="ruby-keyword kw">end</span>
|
387
|
+
</pre>
|
388
|
+
</div>
|
389
|
+
</div>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div id="method-M000018" class="method-detail">
|
393
|
+
<a name="M000018"></a>
|
394
|
+
|
395
|
+
<div class="method-heading">
|
396
|
+
<a href="#M000018" class="method-signature">
|
397
|
+
<span class="method-name">stop</span><span class="method-args">()</span>
|
398
|
+
</a>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="method-description">
|
402
|
+
<p><a class="source-toggle" href="#"
|
403
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
404
|
+
<div class="method-source-code" id="M000018-source">
|
405
|
+
<pre>
|
406
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 387</span>
|
407
|
+
387: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
408
|
+
388: <span class="ruby-comment cmt">#--{{{</span>
|
409
|
+
389: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"not beating"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@beating</span>
|
410
|
+
390: <span class="ruby-ivar">@thread</span>.<span class="ruby-identifier">kill</span>
|
411
|
+
391: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
412
|
+
392: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">false</span>
|
413
|
+
393: <span class="ruby-comment cmt">#--}}}</span>
|
414
|
+
394: <span class="ruby-keyword kw">end</span>
|
415
|
+
</pre>
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
<div id="method-M000019" class="method-detail">
|
421
|
+
<a name="M000019"></a>
|
422
|
+
|
423
|
+
<div class="method-heading">
|
424
|
+
<a href="#M000019" class="method-signature">
|
310
425
|
<span class="method-name">trace</span><span class="method-args">() {|| ...}</span>
|
311
426
|
</a>
|
312
427
|
</div>
|
313
428
|
|
314
429
|
<div class="method-description">
|
315
430
|
<p><a class="source-toggle" href="#"
|
316
|
-
onclick="toggleCode('
|
317
|
-
<div class="method-source-code" id="
|
431
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
432
|
+
<div class="method-source-code" id="M000019-source">
|
318
433
|
<pre>
|
319
|
-
<span class="ruby-comment cmt"># File lib/slave.rb, line
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
434
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 395</span>
|
435
|
+
395: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
|
436
|
+
396: <span class="ruby-comment cmt">#--{{{</span>
|
437
|
+
397: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-keyword kw">yield</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">tty?</span>
|
438
|
+
398: <span class="ruby-comment cmt">#--}}}</span>
|
439
|
+
399: <span class="ruby-keyword kw">end</span>
|
325
440
|
</pre>
|
326
441
|
</div>
|
327
442
|
</div>
|