slave 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,14 +77,34 @@
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">
84
84
  <p>
85
85
  the <a href="Slave.html">Slave</a> class encapsulates the work of setting
86
- up a drb server in another process.
86
+ up a drb server in another process running on localhost. the slave process
87
+ is attached to it&#8217;s parent via a <a
88
+ href="Slave/Heartbeat.html">Heartbeat</a> which is designed such that the
89
+ slave cannot out-live it&#8217;s parent and become a zombie, even if the
90
+ parent dies and early death, such as by &#8216;kill -9&#8217;. the concept
91
+ and purpose of the <a href="Slave.html">Slave</a> class is to be able to
92
+ setup any server object in another process so easily that using a
93
+ multi-process, drb/ipc, based design is as easy, or easier, than a
94
+ multi-threaded one. eg
87
95
  </p>
96
+ <pre>
97
+ class Server
98
+ def add_two n
99
+ n + 2
100
+ end
101
+ end
102
+
103
+ slave = Slave.new Server.new
104
+ server = slave.object
105
+
106
+ p server.add_two(40) #=&gt; 42
107
+ </pre>
88
108
 
89
109
  </div>
90
110
 
@@ -93,13 +113,16 @@ up a drb server in another process.
93
113
  <h2 class="section-bar">Methods</h2>
94
114
 
95
115
  <div class="name-list">
116
+ <a href="#M000004">detach</a>&nbsp;&nbsp;
96
117
  <a href="#M000002">fork</a>&nbsp;&nbsp;
97
- <a href="#M000005">gen_psname</a>&nbsp;&nbsp;
98
- <a href="#M000006">getval</a>&nbsp;&nbsp;
118
+ <a href="#M000008">gen_psname</a>&nbsp;&nbsp;
99
119
  <a href="#M000001">getval</a>&nbsp;&nbsp;
120
+ <a href="#M000009">getval</a>&nbsp;&nbsp;
100
121
  <a href="#M000003">new</a>&nbsp;&nbsp;
101
- <a href="#M000004">shutdown</a>&nbsp;&nbsp;
102
- <a href="#M000007">trace</a>&nbsp;&nbsp;
122
+ <a href="#M000007">shutdown</a>&nbsp;&nbsp;
123
+ <a href="#M000010">trace</a>&nbsp;&nbsp;
124
+ <a href="#M000005">wait</a>&nbsp;&nbsp;
125
+ <a href="#M000006">wait2</a>&nbsp;&nbsp;
103
126
  </div>
104
127
  </div>
105
128
 
@@ -108,11 +131,23 @@ up a drb server in another process.
108
131
 
109
132
  <div class="name-list">
110
133
  <table summary="Constants">
134
+ <tr class="top-aligned-row context-row">
135
+ <td class="context-item-name">VERSION</td>
136
+ <td>=</td>
137
+ <td class="context-item-value">'0.0.1'</td>
138
+ </tr>
111
139
  <tr class="top-aligned-row context-row">
112
140
  <td class="context-item-name">DEFAULT_SOCKET_CREATION_ATTEMPTS</td>
113
141
  <td>=</td>
114
142
  <td class="context-item-value">Integer(ENV['SLAVE_SOCKET_CREATION_ATTEMPTS'] || 42)</td>
115
143
  </tr>
144
+ <tr class="top-aligned-row context-row">
145
+ <td>&nbsp;</td>
146
+ <td colspan="2" class="context-item-desc">
147
+ config
148
+
149
+ </td>
150
+ </tr>
116
151
  <tr class="top-aligned-row context-row">
117
152
  <td class="context-item-name">DEFAULT_PULSE_RATE</td>
118
153
  <td>=</td>
@@ -197,6 +232,11 @@ href="Slave/Heartbeat.html">Heartbeat</a> object
197
232
  <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
198
233
  <td class="context-item-desc"></td>
199
234
  </tr>
235
+ <tr class="top-aligned-row context-row">
236
+ <td class="context-item-name">status</td>
237
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
238
+ <td class="context-item-desc"></td>
239
+ </tr>
200
240
  <tr class="top-aligned-row context-row">
201
241
  <td class="context-item-name">uri</td>
202
242
  <td class="context-item-value">&nbsp;[R]&nbsp;</td>
@@ -241,18 +281,18 @@ just fork with out silly warnings
241
281
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
242
282
  <div class="method-source-code" id="M000002-source">
243
283
  <pre>
244
- <span class="ruby-comment cmt"># File lib/slave.rb, line 47</span>
245
- 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fork</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
246
- 48: <span class="ruby-comment cmt">#--{{{</span>
247
- 49: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">$VERBOSE</span>
248
- 50: <span class="ruby-keyword kw">begin</span>
249
- 51: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-keyword kw">nil</span>
250
- 52: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">fork</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
251
- 53: <span class="ruby-keyword kw">ensure</span>
252
- 54: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">v</span>
253
- 55: <span class="ruby-keyword kw">end</span>
254
- 56: <span class="ruby-comment cmt">#--}}}</span>
255
- 57: <span class="ruby-keyword kw">end</span>
284
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 71</span>
285
+ 71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fork</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
286
+ 72: <span class="ruby-comment cmt">#--{{{</span>
287
+ 73: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">$VERBOSE</span>
288
+ 74: <span class="ruby-keyword kw">begin</span>
289
+ 75: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-keyword kw">nil</span>
290
+ 76: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">fork</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
291
+ 77: <span class="ruby-keyword kw">ensure</span>
292
+ 78: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">v</span>
293
+ 79: <span class="ruby-keyword kw">end</span>
294
+ 80: <span class="ruby-comment cmt">#--}}}</span>
295
+ 81: <span class="ruby-keyword kw">end</span>
256
296
  </pre>
257
297
  </div>
258
298
  </div>
@@ -275,14 +315,14 @@ look up a value in an option hash failing back to class defaults
275
315
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
276
316
  <div class="method-source-code" id="M000001-source">
277
317
  <pre>
278
- <span class="ruby-comment cmt"># File lib/slave.rb, line 39</span>
279
- 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getval</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">opts</span> = {}
280
- 40: <span class="ruby-comment cmt">#--{{{</span>
281
- 41: <span class="ruby-identifier">keys</span> = [<span class="ruby-identifier">key</span>, <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">intern</span>]
282
- 42: <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">k</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>)}
283
- 43: <span class="ruby-identifier">send</span> <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
284
- 44: <span class="ruby-comment cmt">#--}}}</span>
285
- 45: <span class="ruby-keyword kw">end</span>
318
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 63</span>
319
+ 63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getval</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">opts</span> = {}
320
+ 64: <span class="ruby-comment cmt">#--{{{</span>
321
+ 65: <span class="ruby-identifier">keys</span> = [<span class="ruby-identifier">key</span>, <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">intern</span>]
322
+ 66: <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">k</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>)}
323
+ 67: <span class="ruby-identifier">send</span> <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
324
+ 68: <span class="ruby-comment cmt">#--}}}</span>
325
+ 69: <span class="ruby-keyword kw">end</span>
286
326
  </pre>
287
327
  </div>
288
328
  </div>
@@ -293,7 +333,7 @@ look up a value in an option hash failing back to class defaults
293
333
 
294
334
  <div class="method-heading">
295
335
  <a href="#M000003" class="method-signature">
296
- <span class="method-name">new</span><span class="method-args">obj, opts = {}</span>
336
+ <span class="method-name">new</span><span class="method-args">obj = nil, opts = {}, &amp;block</span>
297
337
  </a>
298
338
  </div>
299
339
 
@@ -307,101 +347,106 @@ keys &#8216;socket_creation_attempts&#8217;, &#8216;pulse_rate&#8217;,
307
347
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
308
348
  <div class="method-source-code" id="M000003-source">
309
349
  <pre>
310
- <span class="ruby-comment cmt"># File lib/slave.rb, line 73</span>
311
- 73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">opts</span> = {}
312
- 74: <span class="ruby-comment cmt">#--{{{</span>
313
- 75: <span class="ruby-ivar">@obj</span> = <span class="ruby-identifier">obj</span>
314
- 76:
315
- 77: <span class="ruby-ivar">@socket_creation_attempts</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'socket_creation_attempts'</span>, <span class="ruby-identifier">opts</span>)
316
- 78: <span class="ruby-ivar">@pulse_rate</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'pulse_rate'</span>, <span class="ruby-identifier">opts</span>)
317
- 79: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'debug'</span>, <span class="ruby-identifier">opts</span>)
318
- 80: <span class="ruby-ivar">@psname</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'psname'</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">gen_psname</span>(<span class="ruby-ivar">@obj</span>)
319
- 81:
320
- 82: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;socket_creation_attempts &lt;#{ @socket_creation_attempts }&gt;&quot;</span> }
321
- 83: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;pulse_rate &lt;#{ @pulse_rate }&gt;&quot;</span> }
322
- 84: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;psname &lt;#{ @psname }&gt;&quot;</span> }
323
- 85:
324
- 86: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">false</span>
325
- 87:
326
- 88: <span class="ruby-ivar">@heartbeat</span> = <span class="ruby-constant">Heartbeat</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span> <span class="ruby-ivar">@pulse_rate</span>, <span class="ruby-ivar">@debug</span>
327
- 89: <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>
328
- 90: <span class="ruby-comment cmt">#</span>
329
- 91: <span class="ruby-comment cmt"># child</span>
330
- 92: <span class="ruby-comment cmt">#</span>
331
- 93: <span class="ruby-keyword kw">unless</span>((<span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Slave</span><span class="ruby-operator">::</span><span class="ruby-identifier">fork</span>))
332
- 94: <span class="ruby-keyword kw">begin</span>
333
- 95: <span class="ruby-identifier">$0</span> = <span class="ruby-ivar">@psname</span>
334
- 96: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
335
- 97: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
336
- 98:
337
- 99: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
338
- 100: <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword kw">nil</span>
339
- 101: <span class="ruby-ivar">@uri</span> = <span class="ruby-keyword kw">nil</span>
340
- 102:
341
- 103: <span class="ruby-identifier">tmpdir</span> = <span class="ruby-constant">Dir</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmpdir</span>
342
- 104: <span class="ruby-identifier">basename</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">basename</span> <span class="ruby-ivar">@psname</span>
343
- 105:
344
- 106: <span class="ruby-ivar">@socket_creation_attempts</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attempt</span><span class="ruby-operator">|</span>
345
- 107: <span class="ruby-keyword kw">begin</span>
346
- 108: <span class="ruby-identifier">s</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">tmpdir</span>, <span class="ruby-node">&quot;#{ basename }_#{ attempt }&quot;</span>)
347
- 109: <span class="ruby-identifier">u</span> = <span class="ruby-node">&quot;drbunix://#{ s }&quot;</span>
348
- 110: <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">start_service</span> <span class="ruby-identifier">u</span>, <span class="ruby-identifier">obj</span>
349
- 111: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">s</span>
350
- 112: <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">u</span>
351
- 113: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - socket &lt;#{ @socket }&gt;&quot;</span> }
352
- 114: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - uri &lt;#{ @uri }&gt;&quot;</span> }
353
- 115: <span class="ruby-keyword kw">break</span>
354
- 116: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EADDRINUSE</span>
355
- 117: <span class="ruby-keyword kw">nil</span>
356
- 118: <span class="ruby-keyword kw">end</span>
357
- 119: <span class="ruby-keyword kw">end</span>
358
- 120:
359
- 121: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@uri</span>
360
- 122: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">start</span>
361
- 123: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">write</span> <span class="ruby-ivar">@socket</span>
362
- 124: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
363
- 125: <span class="ruby-identifier">trap</span>(<span class="ruby-value str">'SIGUSR2'</span>) <span class="ruby-keyword kw">do</span>
364
- 126: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
365
- 127: <span class="ruby-constant">DBb</span><span class="ruby-operator">::</span><span class="ruby-identifier">thread</span>.<span class="ruby-identifier">kill</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
366
- 128: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
367
- 129: <span class="ruby-identifier">exit!</span>
368
- 130: <span class="ruby-keyword kw">end</span>
369
- 131: <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">thread</span>.<span class="ruby-identifier">join</span>
370
- 132: <span class="ruby-keyword kw">else</span>
371
- 133: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
372
- 134: <span class="ruby-keyword kw">end</span>
373
- 135: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
374
- 136: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
375
- 137: <span class="ruby-keyword kw">ensure</span>
376
- 138: <span class="ruby-identifier">exit!</span>
377
- 139: <span class="ruby-keyword kw">end</span>
378
- 140: <span class="ruby-comment cmt">#</span>
379
- 141: <span class="ruby-comment cmt"># parent </span>
380
- 142: <span class="ruby-comment cmt">#</span>
381
- 143: <span class="ruby-keyword kw">else</span>
382
- 144: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">detach</span> <span class="ruby-ivar">@pid</span>
383
- 145: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
384
- 146: <span class="ruby-ivar">@socket</span> = <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">read</span>
385
- 147: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
386
- 148:
387
- 149: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - socket &lt;#{ @socket }&gt;&quot;</span> }
388
- 150:
389
- 151: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">exist?</span> <span class="ruby-ivar">@socket</span>
390
- 152: <span class="ruby-identifier">at_exit</span>{ <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-ivar">@socket</span> }
391
- 153: <span class="ruby-ivar">@uri</span> = <span class="ruby-node">&quot;drbunix://#{ socket }&quot;</span>
392
- 154: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - uri &lt;#{ @uri }&gt;&quot;</span> }
393
- 155: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">start</span>
394
- 156: <span class="ruby-comment cmt">#</span>
395
- 157: <span class="ruby-comment cmt"># starting drb on localhost avoids dns lookups!</span>
396
- 158: <span class="ruby-comment cmt">#</span>
397
- 159: <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">start_service</span>(<span class="ruby-value str">'druby://localhost:0'</span>, <span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">thread</span>
398
- 160: <span class="ruby-ivar">@object</span> = <span class="ruby-constant">DRbObject</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-ivar">@uri</span>
399
- 161: <span class="ruby-keyword kw">else</span>
400
- 162: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;failed to find slave socket &lt;#{ @socket }&gt;&quot;</span>
401
- 163: <span class="ruby-keyword kw">end</span>
402
- 164: <span class="ruby-keyword kw">end</span>
403
- 165: <span class="ruby-comment cmt">#--}}}</span>
404
- 166: <span class="ruby-keyword kw">end</span>
350
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 100</span>
351
+ 100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">obj</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
352
+ 101: <span class="ruby-comment cmt">#--{{{</span>
353
+ 102: <span class="ruby-ivar">@obj</span> = <span class="ruby-identifier">obj</span>
354
+ 103:
355
+ 104: <span class="ruby-ivar">@socket_creation_attempts</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'socket_creation_attempts'</span>, <span class="ruby-identifier">opts</span>)
356
+ 105: <span class="ruby-ivar">@pulse_rate</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'pulse_rate'</span>, <span class="ruby-identifier">opts</span>)
357
+ 106: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'debug'</span>, <span class="ruby-identifier">opts</span>)
358
+ 107: <span class="ruby-ivar">@psname</span> = <span class="ruby-identifier">getval</span>(<span class="ruby-value str">'psname'</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">gen_psname</span>(<span class="ruby-ivar">@obj</span>)
359
+ 108:
360
+ 109: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;socket_creation_attempts &lt;#{ @socket_creation_attempts }&gt;&quot;</span> }
361
+ 110: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;pulse_rate &lt;#{ @pulse_rate }&gt;&quot;</span> }
362
+ 111: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;psname &lt;#{ @psname }&gt;&quot;</span> }
363
+ 112:
364
+ 113: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">false</span>
365
+ 114: <span class="ruby-ivar">@waiter</span> = <span class="ruby-ivar">@status</span> = <span class="ruby-keyword kw">nil</span>
366
+ 115:
367
+ 116: <span class="ruby-ivar">@heartbeat</span> = <span class="ruby-constant">Heartbeat</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span> <span class="ruby-ivar">@pulse_rate</span>, <span class="ruby-ivar">@debug</span>
368
+ 117: <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>
369
+ 118: <span class="ruby-comment cmt">#</span>
370
+ 119: <span class="ruby-comment cmt"># child</span>
371
+ 120: <span class="ruby-comment cmt">#</span>
372
+ 121: <span class="ruby-keyword kw">unless</span>((<span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Slave</span><span class="ruby-operator">::</span><span class="ruby-identifier">fork</span>))
373
+ 122: <span class="ruby-identifier">e</span> = <span class="ruby-keyword kw">nil</span>
374
+ 123: <span class="ruby-keyword kw">begin</span>
375
+ 124: <span class="ruby-identifier">$0</span> = <span class="ruby-ivar">@psname</span>
376
+ 125: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
377
+ 126: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
378
+ 127:
379
+ 128: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
380
+ 129: <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword kw">nil</span>
381
+ 130: <span class="ruby-ivar">@uri</span> = <span class="ruby-keyword kw">nil</span>
382
+ 131:
383
+ 132: <span class="ruby-identifier">tmpdir</span> = <span class="ruby-constant">Dir</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmpdir</span>
384
+ 133: <span class="ruby-identifier">basename</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">basename</span> <span class="ruby-ivar">@psname</span>
385
+ 134:
386
+ 135: <span class="ruby-ivar">@socket_creation_attempts</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attempt</span><span class="ruby-operator">|</span>
387
+ 136: <span class="ruby-keyword kw">begin</span>
388
+ 137: <span class="ruby-identifier">s</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">tmpdir</span>, <span class="ruby-node">&quot;#{ basename }_#{ attempt }&quot;</span>)
389
+ 138: <span class="ruby-identifier">u</span> = <span class="ruby-node">&quot;drbunix://#{ s }&quot;</span>
390
+ 139: <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">start_service</span> <span class="ruby-identifier">u</span>, <span class="ruby-identifier">obj</span>
391
+ 140: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">s</span>
392
+ 141: <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">u</span>
393
+ 142: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - socket &lt;#{ @socket }&gt;&quot;</span> }
394
+ 143: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - uri &lt;#{ @uri }&gt;&quot;</span> }
395
+ 144: <span class="ruby-keyword kw">break</span>
396
+ 145: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EADDRINUSE</span>
397
+ 146: <span class="ruby-keyword kw">nil</span>
398
+ 147: <span class="ruby-keyword kw">end</span>
399
+ 148: <span class="ruby-keyword kw">end</span>
400
+ 149:
401
+ 150: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@uri</span>
402
+ 151: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">start</span>
403
+ 152: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">write</span> <span class="ruby-ivar">@socket</span>
404
+ 153: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
405
+ 154: <span class="ruby-identifier">trap</span>(<span class="ruby-value str">'SIGUSR2'</span>) <span class="ruby-keyword kw">do</span>
406
+ 155: <span class="ruby-comment cmt"># @heartbeat.stop rescue nil</span>
407
+ 156: <span class="ruby-constant">DBb</span><span class="ruby-operator">::</span><span class="ruby-identifier">thread</span>.<span class="ruby-identifier">kill</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
408
+ 157: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
409
+ 158: <span class="ruby-identifier">exit!</span>
410
+ 159: <span class="ruby-keyword kw">end</span>
411
+ 160: <span class="ruby-identifier">block</span>[<span class="ruby-identifier">obj</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
412
+ 161: <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">thread</span>.<span class="ruby-identifier">join</span>
413
+ 162: <span class="ruby-keyword kw">else</span>
414
+ 163: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
415
+ 164: <span class="ruby-keyword kw">end</span>
416
+ 165: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
417
+ 166: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
418
+ 167: <span class="ruby-keyword kw">ensure</span>
419
+ 168: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'status'</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>
420
+ 169: <span class="ruby-identifier">exit!</span>(<span class="ruby-identifier">status</span>)
421
+ 170: <span class="ruby-keyword kw">end</span>
422
+ 171: <span class="ruby-comment cmt">#</span>
423
+ 172: <span class="ruby-comment cmt"># parent </span>
424
+ 173: <span class="ruby-comment cmt">#</span>
425
+ 174: <span class="ruby-keyword kw">else</span>
426
+ 175: <span class="ruby-comment cmt">#Process::detach @pid</span>
427
+ 176: <span class="ruby-identifier">detach</span>
428
+ 177: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
429
+ 178: <span class="ruby-ivar">@socket</span> = <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">read</span>
430
+ 179: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
431
+ 180:
432
+ 181: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - socket &lt;#{ @socket }&gt;&quot;</span> }
433
+ 182:
434
+ 183: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@socket</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">exist?</span> <span class="ruby-ivar">@socket</span>
435
+ 184: <span class="ruby-identifier">at_exit</span>{ <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-ivar">@socket</span> }
436
+ 185: <span class="ruby-ivar">@uri</span> = <span class="ruby-node">&quot;drbunix://#{ socket }&quot;</span>
437
+ 186: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - uri &lt;#{ @uri }&gt;&quot;</span> }
438
+ 187: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">start</span>
439
+ 188: <span class="ruby-comment cmt">#</span>
440
+ 189: <span class="ruby-comment cmt"># starting drb on localhost avoids dns lookups!</span>
441
+ 190: <span class="ruby-comment cmt">#</span>
442
+ 191: <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">start_service</span>(<span class="ruby-value str">'druby://localhost:0'</span>, <span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-identifier">thread</span>
443
+ 192: <span class="ruby-ivar">@object</span> = <span class="ruby-constant">DRbObject</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-ivar">@uri</span>
444
+ 193: <span class="ruby-keyword kw">else</span>
445
+ 194: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;failed to find slave socket &lt;#{ @socket }&gt;&quot;</span>
446
+ 195: <span class="ruby-keyword kw">end</span>
447
+ 196: <span class="ruby-keyword kw">end</span>
448
+ 197: <span class="ruby-comment cmt">#--}}}</span>
449
+ 198: <span class="ruby-keyword kw">end</span>
405
450
  </pre>
406
451
  </div>
407
452
  </div>
@@ -409,11 +454,40 @@ keys &#8216;socket_creation_attempts&#8217;, &#8216;pulse_rate&#8217;,
409
454
 
410
455
  <h2 class="section-bar">Public Instance methods</h2>
411
456
 
412
- <div id="method-M000005" class="method-detail">
413
- <a name="M000005"></a>
457
+ <div id="method-M000004" class="method-detail">
458
+ <a name="M000004"></a>
414
459
 
415
460
  <div class="method-heading">
416
- <a href="#M000005" class="method-signature">
461
+ <a href="#M000004" class="method-signature">
462
+ <span class="method-name">detach</span><span class="method-args">()</span>
463
+ </a>
464
+ </div>
465
+
466
+ <div class="method-description">
467
+ <p>
468
+ starts a thread to attempt collecting the child status
469
+ </p>
470
+ <p><a class="source-toggle" href="#"
471
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
472
+ <div class="method-source-code" id="M000004-source">
473
+ <pre>
474
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 202</span>
475
+ 202: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">detach</span>
476
+ 203: <span class="ruby-comment cmt">#--{{{</span>
477
+ 204: <span class="ruby-ivar">@waiter</span> =
478
+ 205: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{ <span class="ruby-ivar">@status</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">waitpid2</span>(<span class="ruby-ivar">@pid</span>).<span class="ruby-identifier">last</span> }
479
+ 206: <span class="ruby-comment cmt">#--}}}</span>
480
+ 207: <span class="ruby-keyword kw">end</span>
481
+ </pre>
482
+ </div>
483
+ </div>
484
+ </div>
485
+
486
+ <div id="method-M000008" class="method-detail">
487
+ <a name="M000008"></a>
488
+
489
+ <div class="method-heading">
490
+ <a href="#M000008" class="method-signature">
417
491
  <span class="method-name">gen_psname</span><span class="method-args">obj</span>
418
492
  </a>
419
493
  </div>
@@ -423,53 +497,53 @@ keys &#8216;socket_creation_attempts&#8217;, &#8216;pulse_rate&#8217;,
423
497
  generate a default name to appear in ps/top
424
498
  </p>
425
499
  <p><a class="source-toggle" href="#"
426
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
427
- <div class="method-source-code" id="M000005-source">
500
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
501
+ <div class="method-source-code" id="M000008-source">
428
502
  <pre>
429
- <span class="ruby-comment cmt"># File lib/slave.rb, line 179</span>
430
- 179: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gen_psname</span> <span class="ruby-identifier">obj</span>
431
- 180: <span class="ruby-comment cmt">#--{{{</span>
432
- 181: <span class="ruby-node">&quot;#{ obj.class }_slave_of_#{ Process::pid }&quot;</span>.<span class="ruby-identifier">downcase</span>
433
- 182: <span class="ruby-comment cmt">#--}}}</span>
434
- 183: <span class="ruby-keyword kw">end</span>
503
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 233</span>
504
+ 233: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gen_psname</span> <span class="ruby-identifier">obj</span>
505
+ 234: <span class="ruby-comment cmt">#--{{{</span>
506
+ 235: <span class="ruby-node">&quot;#{ obj.class }_slave_of_#{ Process::pid }&quot;</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">%/\s*/</span>,<span class="ruby-value str">'_'</span>)
507
+ 236: <span class="ruby-comment cmt">#--}}}</span>
508
+ 237: <span class="ruby-keyword kw">end</span>
435
509
  </pre>
436
510
  </div>
437
511
  </div>
438
512
  </div>
439
513
 
440
- <div id="method-M000006" class="method-detail">
441
- <a name="M000006"></a>
514
+ <div id="method-M000009" class="method-detail">
515
+ <a name="M000009"></a>
442
516
 
443
517
  <div class="method-heading">
444
- <a href="#M000006" class="method-signature">
518
+ <a href="#M000009" class="method-signature">
445
519
  <span class="method-name">getval</span><span class="method-args">key, opts = {}</span>
446
520
  </a>
447
521
  </div>
448
522
 
449
523
  <div class="method-description">
450
524
  <p>
451
- see docs for class.getval
525
+ see docs for <a href="Slave.html#M000001">Slave.getval</a>
452
526
  </p>
453
527
  <p><a class="source-toggle" href="#"
454
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
455
- <div class="method-source-code" id="M000006-source">
528
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
529
+ <div class="method-source-code" id="M000009-source">
456
530
  <pre>
457
- <span class="ruby-comment cmt"># File lib/slave.rb, line 185</span>
458
- 185: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getval</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">opts</span> = {}
459
- 186: <span class="ruby-comment cmt">#--{{{</span>
460
- 187: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">getval</span> <span class="ruby-identifier">key</span>
461
- 188: <span class="ruby-comment cmt">#--}}}</span>
462
- 189: <span class="ruby-keyword kw">end</span>
531
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 241</span>
532
+ 241: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getval</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">opts</span> = {}
533
+ 242: <span class="ruby-comment cmt">#--{{{</span>
534
+ 243: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">getval</span> <span class="ruby-identifier">key</span>
535
+ 244: <span class="ruby-comment cmt">#--}}}</span>
536
+ 245: <span class="ruby-keyword kw">end</span>
463
537
  </pre>
464
538
  </div>
465
539
  </div>
466
540
  </div>
467
541
 
468
- <div id="method-M000004" class="method-detail">
469
- <a name="M000004"></a>
542
+ <div id="method-M000007" class="method-detail">
543
+ <a name="M000007"></a>
470
544
 
471
545
  <div class="method-heading">
472
- <a href="#M000004" class="method-signature">
546
+ <a href="#M000007" class="method-signature">
473
547
  <span class="method-name">shutdown</span><span class="method-args">()</span>
474
548
  </a>
475
549
  </div>
@@ -479,53 +553,95 @@ see docs for class.getval
479
553
  stops the heartbeat thread and kills the child process
480
554
  </p>
481
555
  <p><a class="source-toggle" href="#"
482
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
483
- <div class="method-source-code" id="M000004-source">
556
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
557
+ <div class="method-source-code" id="M000007-source">
484
558
  <pre>
485
- <span class="ruby-comment cmt"># File lib/slave.rb, line 168</span>
486
- 168: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown</span>
487
- 169: <span class="ruby-comment cmt">#--{{{</span>
488
- 170: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;already shutdown&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@shutdown</span>
489
- 171: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
490
- 172: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">kill</span>(<span class="ruby-value str">'SIGUSR2'</span>, <span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
491
- 173: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">kill</span>(<span class="ruby-value str">'SIGTERM'</span>, <span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
492
- 174: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-ivar">@socket</span>
493
- 175: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">true</span>
494
- 176: <span class="ruby-comment cmt">#--}}}</span>
495
- 177: <span class="ruby-keyword kw">end</span>
559
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 220</span>
560
+ 220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown</span>
561
+ 221: <span class="ruby-comment cmt">#--{{{</span>
562
+ 222: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;already shutdown&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@shutdown</span>
563
+ 223: <span class="ruby-ivar">@heartbeat</span>.<span class="ruby-identifier">stop</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
564
+ 224: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">kill</span>(<span class="ruby-value str">'SIGUSR2'</span>, <span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
565
+ 225: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">kill</span>(<span class="ruby-value str">'SIGTERM'</span>, <span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
566
+ 226: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-ivar">@socket</span>
567
+ 227: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">true</span>
568
+ 228: <span class="ruby-comment cmt">#--}}}</span>
569
+ 229: <span class="ruby-keyword kw">end</span>
496
570
  </pre>
497
571
  </div>
498
572
  </div>
499
573
  </div>
500
574
 
501
- <div id="method-M000007" class="method-detail">
502
- <a name="M000007"></a>
575
+ <div id="method-M000010" class="method-detail">
576
+ <a name="M000010"></a>
503
577
 
504
578
  <div class="method-heading">
505
- <a href="#M000007" class="method-signature">
579
+ <a href="#M000010" class="method-signature">
506
580
  <span class="method-name">trace</span><span class="method-args">() {|| ...}</span>
507
581
  </a>
508
582
  </div>
509
583
 
510
584
  <div class="method-description">
511
585
  <p>
512
- debugging output
586
+ debugging output - ENV[&#8216;SLAVE_DEBUG&#8217;]=1 to enable
513
587
  </p>
514
588
  <p><a class="source-toggle" href="#"
515
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
516
- <div class="method-source-code" id="M000007-source">
589
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
590
+ <div class="method-source-code" id="M000010-source">
591
+ <pre>
592
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 249</span>
593
+ 249: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
594
+ 250: <span class="ruby-comment cmt">#--{{{</span>
595
+ 251: <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>
596
+ 252: <span class="ruby-comment cmt">#--}}}</span>
597
+ 253: <span class="ruby-keyword kw">end</span>
598
+ </pre>
599
+ </div>
600
+ </div>
601
+ </div>
602
+
603
+ <div id="method-M000005" class="method-detail">
604
+ <a name="M000005"></a>
605
+
606
+ <div class="method-heading">
607
+ <a href="#M000005" class="method-signature">
608
+ <span class="method-name">wait</span><span class="method-args">()</span>
609
+ </a>
610
+ </div>
611
+
612
+ <div class="method-description">
613
+ <p>
614
+ wait for slave to finish
615
+ </p>
616
+ <p><a class="source-toggle" href="#"
617
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
618
+ <div class="method-source-code" id="M000005-source">
517
619
  <pre>
518
- <span class="ruby-comment cmt"># File lib/slave.rb, line 191</span>
519
- 191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
520
- 192: <span class="ruby-comment cmt">#--{{{</span>
521
- 193: <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>
522
- 194: <span class="ruby-comment cmt">#--}}}</span>
523
- 195: <span class="ruby-keyword kw">end</span>
620
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 211</span>
621
+ 211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait</span>
622
+ 212: <span class="ruby-comment cmt">#--{{{</span>
623
+ 213: <span class="ruby-ivar">@waiter</span>.<span class="ruby-identifier">value</span>
624
+ 214: <span class="ruby-comment cmt">#--}}}</span>
625
+ 215: <span class="ruby-keyword kw">end</span>
524
626
  </pre>
525
627
  </div>
526
628
  </div>
527
629
  </div>
528
630
 
631
+ <div id="method-M000006" class="method-detail">
632
+ <a name="M000006"></a>
633
+
634
+ <div class="method-heading">
635
+ <span class="method-name">wait2</span><span class="method-args">()</span>
636
+ </div>
637
+
638
+ <div class="method-description">
639
+ <p>
640
+ Alias for <a href="Slave.html#M000005">wait</a>
641
+ </p>
642
+ </div>
643
+ </div>
644
+
529
645
 
530
646
  </div>
531
647