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 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/f_2.jpg" usemap="#map" border=0 alt="TopLevel">
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 was it is ensured that <a
89
- href="../Slave.html">Slave</a> object cannot continue to live without their
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="#M000011">child_start</a>&nbsp;&nbsp;
101
- <a href="#M000008">new</a>&nbsp;&nbsp;
102
- <a href="#M000010">parent_start</a>&nbsp;&nbsp;
103
- <a href="#M000009">start</a>&nbsp;&nbsp;
104
- <a href="#M000012">stop</a>&nbsp;&nbsp;
105
- <a href="#M000013">trace</a>&nbsp;&nbsp;
100
+ <a href="#M000014">child_start</a>&nbsp;&nbsp;
101
+ <a href="#M000017">child_start</a>&nbsp;&nbsp;
102
+ <a href="#M000011">new</a>&nbsp;&nbsp;
103
+ <a href="#M000013">parent_start</a>&nbsp;&nbsp;
104
+ <a href="#M000016">parent_start</a>&nbsp;&nbsp;
105
+ <a href="#M000012">start</a>&nbsp;&nbsp;
106
+ <a href="#M000015">start</a>&nbsp;&nbsp;
107
+ <a href="#M000018">stop</a>&nbsp;&nbsp;
108
+ <a href="#M000019">trace</a>&nbsp;&nbsp;
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-M000008" class="method-detail">
126
- <a name="M000008"></a>
128
+ <div id="method-M000011" class="method-detail">
129
+ <a name="M000011"></a>
127
130
 
128
131
  <div class="method-heading">
129
- <a href="#M000008" class="method-signature">
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('M000008-source');return false;">[Source]</a></p>
137
- <div class="method-source-code" id="M000008-source">
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 206</span>
140
- 206: <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>
141
- 207: <span class="ruby-comment cmt">#--{{{</span>
142
- 208: <span class="ruby-ivar">@pulse_rate</span> = <span class="ruby-constant">Float</span> <span class="ruby-identifier">pulse_rate</span>
143
- 209: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">debug</span>
144
- 210: <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>
145
- 211: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
146
- 212: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
147
- 213: <span class="ruby-ivar">@cid</span> = <span class="ruby-keyword kw">nil</span>
148
- 214: <span class="ruby-ivar">@thread</span> = <span class="ruby-keyword kw">nil</span>
149
- 215: <span class="ruby-ivar">@ppid</span> = <span class="ruby-keyword kw">nil</span>
150
- 216: <span class="ruby-ivar">@whoami</span> = <span class="ruby-keyword kw">nil</span>
151
- 217: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">nil</span>
152
- 218: <span class="ruby-ivar">@pipe</span> = <span class="ruby-keyword kw">nil</span>
153
- 219: <span class="ruby-comment cmt">#--}}}</span>
154
- 220: <span class="ruby-keyword kw">end</span>
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-M000011" class="method-detail">
163
- <a name="M000011"></a>
165
+ <div id="method-M000014" class="method-detail">
166
+ <a name="M000014"></a>
164
167
 
165
168
  <div class="method-heading">
166
- <a href="#M000011" class="method-signature">
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('M000011-source');return false;">[Source]</a></p>
174
- <div class="method-source-code" id="M000011-source">
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 254</span>
177
- 254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">child_start</span>
178
- 255: <span class="ruby-comment cmt">#--{{{</span>
179
- 256: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'child'</span>
180
- 257: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
181
- 258: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
182
- 259: <span class="ruby-ivar">@thread</span> =
183
- 260: <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>
184
- 261: <span class="ruby-keyword kw">begin</span>
185
- 262: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
186
- 263: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;&lt;#{ @whoami }&gt; &lt;#{ @pid }&gt; puts &lt;#{ @pid }&gt;&quot;</span> }
187
- 264: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@pid</span>
188
- 265: <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>
189
- 266: <span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@pulse_rate</span>
190
- 267: <span class="ruby-keyword kw">end</span>
191
- 268: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
192
- 269: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
193
- 270: <span class="ruby-keyword kw">ensure</span>
194
- 271: <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>
195
- 272: <span class="ruby-keyword kw">end</span>
196
- 273: <span class="ruby-keyword kw">end</span>
197
- 274: <span class="ruby-comment cmt">#--}}}</span>
198
- 275: <span class="ruby-keyword kw">end</span>
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">&quot;&lt;#{ @whoami }&gt; &lt;#{ @pid }&gt; puts &lt;#{ @pid }&gt;&quot;</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">&gt;</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-M000010" class="method-detail">
205
- <a name="M000010"></a>
207
+ <div id="method-M000017" class="method-detail">
208
+ <a name="M000017"></a>
206
209
 
207
210
  <div class="method-heading">
208
- <a href="#M000010" class="method-signature">
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">&quot;child reading...&quot;</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">&quot;child read.&quot;</span> }
233
+ 377: <span class="ruby-identifier">trace</span>{ <span class="ruby-value str">&quot;child exiting.&quot;</span> }
234
+ 378: <span class="ruby-identifier">exit!</span>
235
+ 379: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</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('M000010-source');return false;">[Source]</a></p>
216
- <div class="method-source-code" id="M000010-source">
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 235</span>
219
- 235: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parent_start</span>
220
- 236: <span class="ruby-comment cmt">#--{{{</span>
221
- 237: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'parent'</span>
222
- 238: <span class="ruby-ivar">@thread</span> =
223
- 239: <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>
224
- 240: <span class="ruby-keyword kw">begin</span>
225
- 241: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
226
- 242: <span class="ruby-identifier">buf</span> = <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">gets</span>
227
- 243: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;&lt;#{ @whoami }&gt; &lt;#{ @pid }&gt; gets &lt;#{ buf.inspect }&gt;&quot;</span> }
228
- 244: <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>
229
- 245: <span class="ruby-keyword kw">end</span>
230
- 246: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
231
- 247: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
232
- 248: <span class="ruby-keyword kw">ensure</span>
233
- 249: <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>
234
- 250: <span class="ruby-keyword kw">end</span>
235
- 251: <span class="ruby-keyword kw">end</span>
236
- 252: <span class="ruby-comment cmt">#--}}}</span>
237
- 253: <span class="ruby-keyword kw">end</span>
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">&quot;&lt;#{ @whoami }&gt; &lt;#{ @pid }&gt; gets &lt;#{ buf.inspect }&gt;&quot;</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">&gt;</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-M000009" class="method-detail">
244
- <a name="M000009"></a>
287
+ <div id="method-M000016" class="method-detail">
288
+ <a name="M000016"></a>
245
289
 
246
290
  <div class="method-heading">
247
- <a href="#M000009" class="method-signature">
248
- <span class="method-name">start</span><span class="method-args">()</span>
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('M000009-source');return false;">[Source]</a></p>
255
- <div class="method-source-code" id="M000009-source">
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 221</span>
258
- 221: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
259
- 222: <span class="ruby-comment cmt">#--{{{</span>
260
- 223: <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>
261
- 224: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
262
- 225: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@r</span>
263
- 226: <span class="ruby-identifier">parent_start</span>
264
- 227: <span class="ruby-keyword kw">else</span>
265
- 228: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
266
- 229: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@w</span>
267
- 230: <span class="ruby-identifier">child_start</span>
268
- 231: <span class="ruby-keyword kw">end</span>
269
- 232: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">true</span>
270
- 233: <span class="ruby-comment cmt">#--}}}</span>
271
- 234: <span class="ruby-keyword kw">end</span>
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">&gt;</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">stop</span><span class="method-args">()</span>
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 276</span>
292
- 276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
293
- 277: <span class="ruby-comment cmt">#--{{{</span>
294
- 278: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;not beating&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@beating</span>
295
- 279: <span class="ruby-ivar">@thread</span>.<span class="ruby-identifier">kill</span>
296
- 280: <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>
297
- 281: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">false</span>
298
- 282: <span class="ruby-comment cmt">#--}}}</span>
299
- 283: <span class="ruby-keyword kw">end</span>
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-M000013" class="method-detail">
306
- <a name="M000013"></a>
357
+ <div id="method-M000015" class="method-detail">
358
+ <a name="M000015"></a>
307
359
 
308
360
  <div class="method-heading">
309
- <a href="#M000013" class="method-signature">
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">&quot;not beating&quot;</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('M000013-source');return false;">[Source]</a></p>
317
- <div class="method-source-code" id="M000013-source">
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 284</span>
320
- 284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
321
- 285: <span class="ruby-comment cmt">#--{{{</span>
322
- 286: <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>
323
- 287: <span class="ruby-comment cmt">#--}}}</span>
324
- 288: <span class="ruby-keyword kw">end</span>
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>