slave 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,390 @@
1
+ This.rubyforge_project = 'codeforpeople'
2
+ This.author = "Ara T. Howard"
3
+ This.email = "ara.t.howard@gmail.com"
4
+ This.homepage = "https://github.com/ahoward/#{ This.lib }"
5
+
6
+
7
+ task :default do
8
+ puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
9
+ end
10
+
11
+ task :test do
12
+ run_tests!
13
+ end
14
+
15
+ namespace :test do
16
+ task(:unit){ run_tests!(:unit) }
17
+ task(:functional){ run_tests!(:functional) }
18
+ task(:integration){ run_tests!(:integration) }
19
+ end
20
+
21
+ def run_tests!(which = nil)
22
+ which ||= '**'
23
+ test_dir = File.join(This.dir, "test")
24
+ test_glob ||= File.join(test_dir, "#{ which }/**_test.rb")
25
+ test_rbs = Dir.glob(test_glob).sort
26
+
27
+ div = ('=' * 119)
28
+ line = ('-' * 119)
29
+
30
+ test_rbs.each_with_index do |test_rb, index|
31
+ testno = index + 1
32
+ command = "#{ This.ruby } -I ./lib -I ./test/lib #{ test_rb }"
33
+
34
+ puts
35
+ say(div, :color => :cyan, :bold => true)
36
+ say("@#{ testno } => ", :bold => true, :method => :print)
37
+ say(command, :color => :cyan, :bold => true)
38
+ say(line, :color => :cyan, :bold => true)
39
+
40
+ system(command)
41
+
42
+ say(line, :color => :cyan, :bold => true)
43
+
44
+ status = $?.exitstatus
45
+
46
+ if status.zero?
47
+ say("@#{ testno } <= ", :bold => true, :color => :white, :method => :print)
48
+ say("SUCCESS", :color => :green, :bold => true)
49
+ else
50
+ say("@#{ testno } <= ", :bold => true, :color => :white, :method => :print)
51
+ say("FAILURE", :color => :red, :bold => true)
52
+ end
53
+ say(line, :color => :cyan, :bold => true)
54
+
55
+ exit(status) unless status.zero?
56
+ end
57
+ end
58
+
59
+
60
+ task :gemspec do
61
+ ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
62
+ ignore_directories = ['pkg']
63
+ ignore_files = ['test/log', 'a.rb'] + Dir['db/*'] + %w'db'
64
+
65
+ shiteless =
66
+ lambda do |list|
67
+ list.delete_if do |entry|
68
+ next unless test(?e, entry)
69
+ extension = File.basename(entry).split(%r/[.]/).last
70
+ ignore_extensions.any?{|ext| ext === extension}
71
+ end
72
+ list.delete_if do |entry|
73
+ next unless test(?d, entry)
74
+ dirname = File.expand_path(entry)
75
+ ignore_directories.any?{|dir| File.expand_path(dir) == dirname}
76
+ end
77
+ list.delete_if do |entry|
78
+ next unless test(?f, entry)
79
+ filename = File.expand_path(entry)
80
+ ignore_files.any?{|file| File.expand_path(file) == filename}
81
+ end
82
+ end
83
+
84
+ lib = This.lib
85
+ object = This.object
86
+ version = This.version
87
+ files = shiteless[Dir::glob("**/**")]
88
+ executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
89
+ #has_rdoc = true #File.exist?('doc')
90
+ test_files = test(?e, "test/#{ lib }.rb") ? "test/#{ lib }.rb" : nil
91
+ summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
92
+ description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
93
+
94
+ if This.extensions.nil?
95
+ This.extensions = []
96
+ extensions = This.extensions
97
+ %w( Makefile configure extconf.rb ).each do |ext|
98
+ extensions << ext if File.exists?(ext)
99
+ end
100
+ end
101
+ extensions = [extensions].flatten.compact
102
+
103
+ # TODO
104
+ if This.dependencies.nil?
105
+ dependencies = []
106
+ else
107
+ case This.dependencies
108
+ when Hash
109
+ dependencies = This.dependencies.values
110
+ when Array
111
+ dependencies = This.dependencies
112
+ end
113
+ end
114
+
115
+ template =
116
+ if test(?e, 'gemspec.erb')
117
+ Template{ IO.read('gemspec.erb') }
118
+ else
119
+ Template {
120
+ <<-__
121
+ ## <%= lib %>.gemspec
122
+ #
123
+
124
+ Gem::Specification::new do |spec|
125
+ spec.name = <%= lib.inspect %>
126
+ spec.version = <%= version.inspect %>
127
+ spec.platform = Gem::Platform::RUBY
128
+ spec.summary = <%= lib.inspect %>
129
+ spec.description = <%= description.inspect %>
130
+
131
+ spec.files =\n<%= files.sort.pretty_inspect %>
132
+ spec.executables = <%= executables.inspect %>
133
+
134
+ spec.require_path = "lib"
135
+
136
+ spec.test_files = <%= test_files.inspect %>
137
+
138
+ <% dependencies.each do |lib_version| %>
139
+ spec.add_dependency(*<%= Array(lib_version).flatten.inspect %>)
140
+ <% end %>
141
+
142
+ spec.extensions.push(*<%= extensions.inspect %>)
143
+
144
+ spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
145
+ spec.author = <%= This.author.inspect %>
146
+ spec.email = <%= This.email.inspect %>
147
+ spec.homepage = <%= This.homepage.inspect %>
148
+ end
149
+ __
150
+ }
151
+ end
152
+
153
+ Fu.mkdir_p(This.pkgdir)
154
+ gemspec = "#{ lib }.gemspec"
155
+ open(gemspec, "w"){|fd| fd.puts(template)}
156
+ This.gemspec = gemspec
157
+ end
158
+
159
+ task :gem => [:clean, :gemspec] do
160
+ Fu.mkdir_p(This.pkgdir)
161
+ before = Dir['*.gem']
162
+ cmd = "gem build #{ This.gemspec }"
163
+ `#{ cmd }`
164
+ after = Dir['*.gem']
165
+ gem = ((after - before).first || after.first) or abort('no gem!')
166
+ Fu.mv(gem, This.pkgdir)
167
+ This.gem = File.join(This.pkgdir, File.basename(gem))
168
+ end
169
+
170
+ task :readme do
171
+ samples = ''
172
+ prompt = '~ > '
173
+ lib = This.lib
174
+ version = This.version
175
+
176
+ Dir['sample*/*'].sort.each do |sample|
177
+ samples << "\n" << " <========< #{ sample } >========>" << "\n\n"
178
+
179
+ cmd = "cat #{ sample }"
180
+ samples << Util.indent(prompt + cmd, 2) << "\n\n"
181
+ samples << Util.indent(`#{ cmd }`, 4) << "\n"
182
+
183
+ cmd = "ruby #{ sample }"
184
+ samples << Util.indent(prompt + cmd, 2) << "\n\n"
185
+
186
+ cmd = "ruby -e'STDOUT.sync=true; exec %(ruby -I ./lib #{ sample })'"
187
+ samples << Util.indent(`#{ cmd } 2>&1`, 4) << "\n"
188
+ end
189
+
190
+ template =
191
+ if test(?e, 'readme.erb')
192
+ Template{ IO.read('readme.erb') }
193
+ else
194
+ Template {
195
+ <<-__
196
+ NAME
197
+ #{ lib }
198
+
199
+ DESCRIPTION
200
+
201
+ INSTALL
202
+ gem install #{ lib }
203
+
204
+ SAMPLES
205
+ #{ samples }
206
+ __
207
+ }
208
+ end
209
+
210
+ open("README", "w"){|fd| fd.puts template}
211
+ end
212
+
213
+
214
+ task :clean do
215
+ Dir[File.join(This.pkgdir, '**/**')].each{|entry| Fu.rm_rf(entry)}
216
+ end
217
+
218
+
219
+ task :release => [:clean, :gemspec, :gem] do
220
+ gems = Dir[File.join(This.pkgdir, '*.gem')].flatten
221
+ raise "which one? : #{ gems.inspect }" if gems.size > 1
222
+ raise "no gems?" if gems.size < 1
223
+
224
+ cmd = "gem push #{ This.gem }"
225
+ puts cmd
226
+ puts
227
+ system(cmd)
228
+ abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
229
+
230
+ cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
231
+ puts cmd
232
+ puts
233
+ system(cmd)
234
+ abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
235
+ end
236
+
237
+
238
+
239
+
240
+
241
+ BEGIN {
242
+ # support for this rakefile
243
+ #
244
+ $VERBOSE = nil
245
+
246
+ require 'ostruct'
247
+ require 'erb'
248
+ require 'fileutils'
249
+ require 'rbconfig'
250
+ require 'pp'
251
+
252
+ # fu shortcut
253
+ #
254
+ Fu = FileUtils
255
+
256
+ # cache a bunch of stuff about this rakefile/environment
257
+ #
258
+ This = OpenStruct.new
259
+
260
+ This.file = File.expand_path(__FILE__)
261
+ This.dir = File.dirname(This.file)
262
+ This.pkgdir = File.join(This.dir, 'pkg')
263
+
264
+ # grok lib
265
+ #
266
+ lib = ENV['LIB']
267
+ unless lib
268
+ lib = File.basename(Dir.pwd).sub(/[-].*$/, '')
269
+ end
270
+ This.lib = lib
271
+
272
+ # grok version
273
+ #
274
+ version = ENV['VERSION']
275
+ unless version
276
+ require "./lib/#{ This.lib }"
277
+ This.name = lib.capitalize
278
+ This.object = eval(This.name)
279
+ version = This.object.send(:version)
280
+ end
281
+ This.version = version
282
+
283
+ # see if dependencies are export by the module
284
+ #
285
+ if This.object.respond_to?(:dependencies)
286
+ This.dependencies = This.object.dependencies
287
+ end
288
+
289
+ # we need to know the name of the lib an it's version
290
+ #
291
+ abort('no lib') unless This.lib
292
+ abort('no version') unless This.version
293
+
294
+ # discover full path to this ruby executable
295
+ #
296
+ c = Config::CONFIG
297
+ bindir = c["bindir"] || c['BINDIR']
298
+ ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
299
+ ruby_ext = c['EXEEXT'] || ''
300
+ ruby = File.join(bindir, (ruby_install_name + ruby_ext))
301
+ This.ruby = ruby
302
+
303
+ # some utils
304
+ #
305
+ module Util
306
+ def indent(s, n = 2)
307
+ s = unindent(s)
308
+ ws = ' ' * n
309
+ s.gsub(%r/^/, ws)
310
+ end
311
+
312
+ def unindent(s)
313
+ indent = nil
314
+ s.each_line do |line|
315
+ next if line =~ %r/^\s*$/
316
+ indent = line[%r/^\s*/] and break
317
+ end
318
+ indent ? s.gsub(%r/^#{ indent }/, "") : s
319
+ end
320
+ extend self
321
+ end
322
+
323
+ # template support
324
+ #
325
+ class Template
326
+ def initialize(&block)
327
+ @block = block
328
+ @template = block.call.to_s
329
+ end
330
+ def expand(b=nil)
331
+ ERB.new(Util.unindent(@template)).result((b||@block).binding)
332
+ end
333
+ alias_method 'to_s', 'expand'
334
+ end
335
+ def Template(*args, &block) Template.new(*args, &block) end
336
+
337
+ # colored console output support
338
+ #
339
+ This.ansi = {
340
+ :clear => "\e[0m",
341
+ :reset => "\e[0m",
342
+ :erase_line => "\e[K",
343
+ :erase_char => "\e[P",
344
+ :bold => "\e[1m",
345
+ :dark => "\e[2m",
346
+ :underline => "\e[4m",
347
+ :underscore => "\e[4m",
348
+ :blink => "\e[5m",
349
+ :reverse => "\e[7m",
350
+ :concealed => "\e[8m",
351
+ :black => "\e[30m",
352
+ :red => "\e[31m",
353
+ :green => "\e[32m",
354
+ :yellow => "\e[33m",
355
+ :blue => "\e[34m",
356
+ :magenta => "\e[35m",
357
+ :cyan => "\e[36m",
358
+ :white => "\e[37m",
359
+ :on_black => "\e[40m",
360
+ :on_red => "\e[41m",
361
+ :on_green => "\e[42m",
362
+ :on_yellow => "\e[43m",
363
+ :on_blue => "\e[44m",
364
+ :on_magenta => "\e[45m",
365
+ :on_cyan => "\e[46m",
366
+ :on_white => "\e[47m"
367
+ }
368
+ def say(phrase, *args)
369
+ options = args.last.is_a?(Hash) ? args.pop : {}
370
+ options[:color] = args.shift.to_s.to_sym unless args.empty?
371
+ keys = options.keys
372
+ keys.each{|key| options[key.to_s.to_sym] = options.delete(key)}
373
+
374
+ color = options[:color]
375
+ bold = options.has_key?(:bold)
376
+
377
+ parts = [phrase]
378
+ parts.unshift(This.ansi[color]) if color
379
+ parts.unshift(This.ansi[:bold]) if bold
380
+ parts.push(This.ansi[:clear]) if parts.size > 1
381
+
382
+ method = options[:method] || :puts
383
+
384
+ Kernel.send(method, parts.join)
385
+ end
386
+
387
+ # always run out of the project dir
388
+ #
389
+ Dir.chdir(This.dir)
390
+ }
@@ -1,45 +1,45 @@
1
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
2
  <!DOCTYPE html
3
3
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "DTD/xhtml1-transitional.dtd">
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
5
 
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
- <title>Class: Slave</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
8
+ <title>Class: Slave</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
43
 
44
44
  </head>
45
45
  <body>
@@ -47,15 +47,18 @@
47
47
 
48
48
 
49
49
  <div id="classHeader">
50
- <h1>Slave <sup class="type-note">(Class)</sup></h1>
51
50
  <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Slave</td>
54
+ </tr>
52
55
  <tr class="top-aligned-row">
53
56
  <td><strong>In:</strong></td>
54
57
  <td>
55
58
  <a href="../files/lib/slave_rb.html">
56
59
  lib/slave.rb
57
60
  </a>
58
- <br />
61
+ <br />
59
62
  </td>
60
63
  </tr>
61
64
 
@@ -69,30 +72,30 @@
69
72
  </div>
70
73
  <!-- banner header -->
71
74
 
72
- <div id="bodyContent">
75
+ <div id="bodyContent">
73
76
 
74
77
 
75
- <div id="contextContent">
76
- <div id="diagram">
77
- <map name="map">
78
- <area shape="RECT" coords="123,98,195,50" href="o.html" alt="o">
79
- <area shape="RECT" coords="27,98,99,50" href="Slave.html" alt="Slave">
78
+
79
+ <div id="contextContent">
80
+ <div id="diagram">
81
+ <map id="map" name="map">
82
+ <area shape="rect" coords="27,50,99,98" href="Slave.html" alt="Slave" />
80
83
  </map>
81
- <img src="../dot/f_1.jpg" usemap="#map" border=0 alt="TopLevel">
82
- </div>
84
+ <img src="../dot/f_1.jpg" usemap="#map" border="0" alt="dot/f_1.jpg">
85
+ </div>
83
86
 
84
- <div id="description">
85
- <p>
87
+ <div id="description">
88
+ <p>
86
89
  the <a href="Slave.html">Slave</a> class encapsulates the work of setting
87
90
  up a drb server in another process running on localhost via unix domain
88
- sockets. the slave process is attached to it&#8217;s parent via a <a
91
+ sockets. the slave process is attached to it&#8216;s parent via a <a
89
92
  href="Slave/LifeLine.html">LifeLine</a> which is designed such that the
90
- slave cannot out-live it&#8217;s parent and become a zombie, even if the
93
+ slave cannot out-live it&#8216;s parent and become a zombie, even if the
91
94
  parent dies and early death, such as by &#8216;kill -9&#8217;. the concept
92
95
  and purpose of the <a href="Slave.html">Slave</a> class is to be able to
93
- setup any server object in another process so easily that using a
94
- multi-process, drb/ipc, based design is as easy, or easier, than a
95
- multi-threaded one. eg
96
+ setup any server <a href="Slave.html#M000015">object</a> in another process
97
+ so easily that using a multi-process, drb/ipc, based design is as easy, or
98
+ easier, than a multi-threaded one. eg
96
99
  </p>
97
100
  <pre>
98
101
  class Server
@@ -123,208 +126,205 @@ called only in the child&quot; }
123
126
  of the two &#8216;b&#8217; is preferred.
124
127
  </p>
125
128
 
126
- </div>
127
-
128
-
129
- <div id="method-list">
130
- <h2 class="section-bar">Methods</h2>
131
-
132
- <div class="name-list">
133
- <a href="#M000012">default</a>&nbsp;&nbsp;
134
- <a href="#M000002">default</a>&nbsp;&nbsp;
135
- <a href="#M000006">detach</a>&nbsp;&nbsp;
136
- <a href="#M000004">fork</a>&nbsp;&nbsp;
137
- <a href="#M000011">gen_psname</a>&nbsp;&nbsp;
138
- <a href="#M000003">getopts</a>&nbsp;&nbsp;
139
- <a href="#M000013">getopts</a>&nbsp;&nbsp;
140
- <a href="#M000005">new</a>&nbsp;&nbsp;
141
- <a href="#M000015">object</a>&nbsp;&nbsp;
142
- <a href="#M000016">object</a>&nbsp;&nbsp;
143
- <a href="#M000009">shutdown</a>&nbsp;&nbsp;
144
- <a href="#M000010">shutdown?</a>&nbsp;&nbsp;
145
- <a href="#M000014">trace</a>&nbsp;&nbsp;
146
- <a href="#M000001">version</a>&nbsp;&nbsp;
147
- <a href="#M000007">wait</a>&nbsp;&nbsp;
148
- <a href="#M000008">wait2</a>&nbsp;&nbsp;
149
- </div>
150
- </div>
151
-
152
- <div id="constants-list">
153
- <h2 class="section-bar">Constants</h2>
154
-
155
- <div class="name-list">
156
- <table summary="Constants">
157
- <tr class="top-aligned-row context-row">
158
- <td class="context-item-name">VERSION</td>
159
- <td>=</td>
160
- <td class="context-item-value">'1.1.0'</td>
161
- </tr>
162
- <tr class="top-aligned-row context-row">
163
- <td class="context-item-name">DEFAULT_SOCKET_CREATION_ATTEMPTS</td>
164
- <td>=</td>
165
- <td class="context-item-value">Integer(ENV['SLAVE_SOCKET_CREATION_ATTEMPTS'] || 42)</td>
166
- </tr>
167
- <tr class="top-aligned-row context-row">
168
- <td>&nbsp;</td>
169
- <td colspan="2" class="context-item-desc">
129
+ </div>
130
+
131
+
132
+ </div>
133
+
134
+ <div id="method-list">
135
+ <h3 class="section-bar">Methods</h3>
136
+
137
+ <div class="name-list">
138
+ <a href="#M000012">default</a>&nbsp;&nbsp;
139
+ <a href="#M000002">default</a>&nbsp;&nbsp;
140
+ <a href="#M000006">detach</a>&nbsp;&nbsp;
141
+ <a href="#M000004">fork</a>&nbsp;&nbsp;
142
+ <a href="#M000011">gen_psname</a>&nbsp;&nbsp;
143
+ <a href="#M000003">getopts</a>&nbsp;&nbsp;
144
+ <a href="#M000013">getopts</a>&nbsp;&nbsp;
145
+ <a href="#M000005">new</a>&nbsp;&nbsp;
146
+ <a href="#M000015">object</a>&nbsp;&nbsp;
147
+ <a href="#M000009">shutdown</a>&nbsp;&nbsp;
148
+ <a href="#M000010">shutdown?</a>&nbsp;&nbsp;
149
+ <a href="#M000014">trace</a>&nbsp;&nbsp;
150
+ <a href="#M000001">version</a>&nbsp;&nbsp;
151
+ <a href="#M000007">wait</a>&nbsp;&nbsp;
152
+ <a href="#M000008">wait2</a>&nbsp;&nbsp;
153
+ </div>
154
+ </div>
155
+
156
+ </div>
157
+
158
+
159
+ <!-- if includes -->
160
+
161
+ <div id="section">
162
+
163
+ <div id="class-list">
164
+ <h3 class="section-bar">Classes and Modules</h3>
165
+
166
+ Class <a href="Slave/LifeLine.html" class="link">Slave::LifeLine</a><br />
167
+ Class <a href="Slave/ThreadSafe.html" class="link">Slave::ThreadSafe</a><br />
168
+ Class <a href="Slave/ThreadSafeHash.html" class="link">Slave::ThreadSafeHash</a><br />
169
+
170
+ </div>
171
+
172
+ <div id="constants-list">
173
+ <h3 class="section-bar">Constants</h3>
174
+
175
+ <div class="name-list">
176
+ <table summary="Constants">
177
+ <tr class="top-aligned-row context-row">
178
+ <td class="context-item-name">VERSION</td>
179
+ <td>=</td>
180
+ <td class="context-item-value">'1.2.1'</td>
181
+ </tr>
182
+ <tr class="top-aligned-row context-row">
183
+ <td class="context-item-name">DEFAULT_SOCKET_CREATION_ATTEMPTS</td>
184
+ <td>=</td>
185
+ <td class="context-item-value">Integer(ENV['SLAVE_SOCKET_CREATION_ATTEMPTS'] || 42)</td>
186
+ <td width="3em">&nbsp;</td>
187
+ <td class="context-item-desc">
170
188
  env config
171
189
 
172
190
  </td>
173
- </tr>
174
- <tr class="top-aligned-row context-row">
175
- <td class="context-item-name">DEFAULT_DEBUG</td>
176
- <td>=</td>
177
- <td class="context-item-value">(ENV['SLAVE_DEBUG'] ? true : false)</td>
178
- </tr>
179
- <tr class="top-aligned-row context-row">
180
- <td class="context-item-name">DEFAULT_THREADSAFE</td>
181
- <td>=</td>
182
- <td class="context-item-value">(ENV['SLAVE_THREADSAFE'] ? true : false)</td>
183
- </tr>
184
- </table>
185
- </div>
186
- </div>
187
-
188
-
189
-
190
- <div id="attribute-list">
191
- <h2 class="section-bar">Attributes</h2>
192
-
193
- <div class="name-list">
194
- <table>
195
- <tr class="top-aligned-row context-row">
196
- <td class="context-item-name">at_exit</td>
197
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
198
- <td class="context-item-desc"></td>
199
- </tr>
200
- <tr class="top-aligned-row context-row">
201
- <td class="context-item-name">debug</td>
202
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
203
- <td class="context-item-desc">
191
+ </tr>
192
+ <tr class="top-aligned-row context-row">
193
+ <td class="context-item-name">DEFAULT_DEBUG</td>
194
+ <td>=</td>
195
+ <td class="context-item-value">(ENV['SLAVE_DEBUG'] ? true : false)</td>
196
+ </tr>
197
+ <tr class="top-aligned-row context-row">
198
+ <td class="context-item-name">DEFAULT_THREADSAFE</td>
199
+ <td>=</td>
200
+ <td class="context-item-value">(ENV['SLAVE_THREADSAFE'] ? true : false)</td>
201
+ </tr>
202
+ </table>
203
+ </div>
204
+ </div>
205
+
206
+
207
+
208
+ <div id="attribute-list">
209
+ <h3 class="section-bar">Attributes</h3>
210
+
211
+ <div class="name-list">
212
+ <table>
213
+ <tr class="top-aligned-row context-row">
214
+ <td class="context-item-name">at_exit</td>
215
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
216
+ <td class="context-item-desc"></td>
217
+ </tr>
218
+ <tr class="top-aligned-row context-row">
219
+ <td class="context-item-name">debug</td>
220
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
221
+ <td class="context-item-desc">
204
222
  if this is true and you are running from a terminal information is printed
205
223
  on STDERR
206
224
 
207
225
  </td>
208
- </tr>
209
- <tr class="top-aligned-row context-row">
210
- <td class="context-item-name">debug</td>
211
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
212
- <td class="context-item-desc"></td>
213
- </tr>
214
- <tr class="top-aligned-row context-row">
215
- <td class="context-item-name">dumped</td>
216
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
217
- <td class="context-item-desc"></td>
218
- </tr>
219
- <tr class="top-aligned-row context-row">
220
- <td class="context-item-name">obj</td>
221
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
222
- <td class="context-item-desc">
226
+ </tr>
227
+ <tr class="top-aligned-row context-row">
228
+ <td class="context-item-name">debug</td>
229
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
230
+ <td class="context-item-desc"></td>
231
+ </tr>
232
+ <tr class="top-aligned-row context-row">
233
+ <td class="context-item-name">dumped</td>
234
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
235
+ <td class="context-item-desc"></td>
236
+ </tr>
237
+ <tr class="top-aligned-row context-row">
238
+ <td class="context-item-name">obj</td>
239
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
240
+ <td class="context-item-desc">
223
241
  attrs
224
242
 
225
243
  </td>
226
- </tr>
227
- <tr class="top-aligned-row context-row">
228
- <td class="context-item-name">object</td>
229
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
230
- <td class="context-item-desc"></td>
231
- </tr>
232
- <tr class="top-aligned-row context-row">
233
- <td class="context-item-name">pid</td>
234
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
235
- <td class="context-item-desc"></td>
236
- </tr>
237
- <tr class="top-aligned-row context-row">
238
- <td class="context-item-name">ppid</td>
239
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
240
- <td class="context-item-desc"></td>
241
- </tr>
242
- <tr class="top-aligned-row context-row">
243
- <td class="context-item-name">psname</td>
244
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
245
- <td class="context-item-desc"></td>
246
- </tr>
247
- <tr class="top-aligned-row context-row">
248
- <td class="context-item-name">shutdown</td>
249
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
250
- <td class="context-item-desc"></td>
251
- </tr>
252
- <tr class="top-aligned-row context-row">
253
- <td class="context-item-name">socket</td>
254
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
255
- <td class="context-item-desc"></td>
256
- </tr>
257
- <tr class="top-aligned-row context-row">
258
- <td class="context-item-name">socket_creation_attempts</td>
259
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
260
- <td class="context-item-desc"></td>
261
- </tr>
262
- <tr class="top-aligned-row context-row">
263
- <td class="context-item-name">socket_creation_attempts</td>
264
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
265
- <td class="context-item-desc"></td>
266
- </tr>
267
- <tr class="top-aligned-row context-row">
268
- <td class="context-item-name">status</td>
269
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
270
- <td class="context-item-desc"></td>
271
- </tr>
272
- <tr class="top-aligned-row context-row">
273
- <td class="context-item-name">threadsafe</td>
274
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
275
- <td class="context-item-desc">
244
+ </tr>
245
+ <tr class="top-aligned-row context-row">
246
+ <td class="context-item-name">object</td>
247
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
248
+ <td class="context-item-desc"></td>
249
+ </tr>
250
+ <tr class="top-aligned-row context-row">
251
+ <td class="context-item-name">pid</td>
252
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
253
+ <td class="context-item-desc"></td>
254
+ </tr>
255
+ <tr class="top-aligned-row context-row">
256
+ <td class="context-item-name">ppid</td>
257
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
258
+ <td class="context-item-desc"></td>
259
+ </tr>
260
+ <tr class="top-aligned-row context-row">
261
+ <td class="context-item-name">psname</td>
262
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
263
+ <td class="context-item-desc"></td>
264
+ </tr>
265
+ <tr class="top-aligned-row context-row">
266
+ <td class="context-item-name">socket</td>
267
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
268
+ <td class="context-item-desc"></td>
269
+ </tr>
270
+ <tr class="top-aligned-row context-row">
271
+ <td class="context-item-name">socket_creation_attempts</td>
272
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
273
+ <td class="context-item-desc"></td>
274
+ </tr>
275
+ <tr class="top-aligned-row context-row">
276
+ <td class="context-item-name">socket_creation_attempts</td>
277
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
278
+ <td class="context-item-desc"></td>
279
+ </tr>
280
+ <tr class="top-aligned-row context-row">
281
+ <td class="context-item-name">status</td>
282
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
283
+ <td class="context-item-desc"></td>
284
+ </tr>
285
+ <tr class="top-aligned-row context-row">
286
+ <td class="context-item-name">threadsafe</td>
287
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
288
+ <td class="context-item-desc">
276
289
  if this is true all slave objects will be wrapped such that any call to the
277
- object is threadsafe. if you do not use this you must ensure that your
278
- objects are threadsafe <em>yourself</em> as this is required of any object
279
- acting as a drb server
290
+ <a href="Slave.html#M000015">object</a> is threadsafe. if you do not use
291
+ this you must ensure that your objects are threadsafe <em>yourself</em> as
292
+ this is required of any <a href="Slave.html#M000015">object</a> acting as a
293
+ drb server
280
294
 
281
295
  </td>
282
- </tr>
283
- <tr class="top-aligned-row context-row">
284
- <td class="context-item-name">uri</td>
285
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
286
- <td class="context-item-desc"></td>
287
- </tr>
288
- </table>
289
- </div>
290
- </div>
291
-
292
- <div id="class-list">
293
- <h2 class="section-bar">Classes and Modules</h2>
294
-
295
- Class <a href="Slave/LifeLine.html" class="link">Slave::LifeLine</a><br />
296
- Class <a href="Slave/ThreadSafe.html" class="link">Slave::ThreadSafe</a><br />
297
- Class <a href="Slave/ThreadSafeHash.html" class="link">Slave::ThreadSafeHash</a><br />
298
-
299
- </div>
300
-
301
- </div>
302
-
303
-
304
-
305
- <!-- if includes -->
296
+ </tr>
297
+ <tr class="top-aligned-row context-row">
298
+ <td class="context-item-name">uri</td>
299
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
300
+ <td class="context-item-desc"></td>
301
+ </tr>
302
+ </table>
303
+ </div>
304
+ </div>
305
+
306
306
 
307
307
 
308
- <!-- if method_list -->
309
- <div id="methods">
310
- <h2 class="section-bar">Public Class methods</h2>
308
+ <!-- if method_list -->
309
+ <div id="methods">
310
+ <h3 class="section-bar">Public Class methods</h3>
311
311
 
312
- <div id="method-M000002" class="method-detail">
313
- <a name="M000002"></a>
312
+ <div id="method-M000002" class="method-detail">
313
+ <a name="M000002"></a>
314
314
 
315
- <div class="method-heading">
316
- <a href="#M000002" class="method-signature">
317
- <span class="method-name">default</span><span class="method-args">key</span>
318
- </a>
319
- </div>
320
-
321
- <div class="method-description">
322
- <p>
323
- get a default value
315
+ <div class="method-heading">
316
+ <a href="#M000002" class="method-signature">
317
+ <span class="method-name">default</span><span class="method-args">(key)</span>
318
+ </a>
319
+ </div>
320
+
321
+ <div class="method-description">
322
+ <p>
323
+ get a <a href="Slave.html#M000002">default</a> value
324
324
  </p>
325
- <p><a class="source-toggle" href="#"
326
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
327
- <div class="method-source-code" id="M000002-source">
325
+ <p><a class="source-toggle" href="#"
326
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
327
+ <div class="method-source-code" id="M000002-source">
328
328
  <pre>
329
329
  <span class="ruby-comment cmt"># File lib/slave.rb, line 77</span>
330
330
  77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span> <span class="ruby-identifier">key</span>
@@ -333,57 +333,57 @@ get a default value
333
333
  80: <span class="ruby-comment cmt">#--}}}</span>
334
334
  81: <span class="ruby-keyword kw">end</span>
335
335
  </pre>
336
- </div>
337
- </div>
338
- </div>
339
-
340
- <div id="method-M000004" class="method-detail">
341
- <a name="M000004"></a>
342
-
343
- <div class="method-heading">
344
- <a href="#M000004" class="method-signature">
345
- <span class="method-name">fork</span><span class="method-args">(&amp;block)</span>
346
- </a>
347
- </div>
348
-
349
- <div class="method-description">
350
- <p>
351
- just fork with out silly warnings
336
+ </div>
337
+ </div>
338
+ </div>
339
+
340
+ <div id="method-M000004" class="method-detail">
341
+ <a name="M000004"></a>
342
+
343
+ <div class="method-heading">
344
+ <a href="#M000004" class="method-signature">
345
+ <span class="method-name">fork</span><span class="method-args">(&amp;b)</span>
346
+ </a>
347
+ </div>
348
+
349
+ <div class="method-description">
350
+ <p>
351
+ just <a href="Slave.html#M000004">fork</a> with out silly warnings
352
352
  </p>
353
- <p><a class="source-toggle" href="#"
354
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
355
- <div class="method-source-code" id="M000004-source">
353
+ <p><a class="source-toggle" href="#"
354
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
355
+ <div class="method-source-code" id="M000004-source">
356
356
  <pre>
357
357
  <span class="ruby-comment cmt"># File lib/slave.rb, line 98</span>
358
- 98: <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>
358
+ 98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fork</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
359
359
  99: <span class="ruby-comment cmt">#--{{{</span>
360
360
  100: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">$VERBOSE</span>
361
361
  101: <span class="ruby-keyword kw">begin</span>
362
362
  102: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-keyword kw">nil</span>
363
- 103: <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>
363
+ 103: <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">b</span>)
364
364
  104: <span class="ruby-keyword kw">ensure</span>
365
365
  105: <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">v</span>
366
366
  106: <span class="ruby-keyword kw">end</span>
367
367
  107: <span class="ruby-comment cmt">#--}}}</span>
368
368
  108: <span class="ruby-keyword kw">end</span>
369
369
  </pre>
370
- </div>
371
- </div>
372
- </div>
373
-
374
- <div id="method-M000003" class="method-detail">
375
- <a name="M000003"></a>
376
-
377
- <div class="method-heading">
378
- <a href="#M000003" class="method-signature">
379
- <span class="method-name">getopts</span><span class="method-args">opts</span>
380
- </a>
381
- </div>
382
-
383
- <div class="method-description">
384
- <p><a class="source-toggle" href="#"
385
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
386
- <div class="method-source-code" id="M000003-source">
370
+ </div>
371
+ </div>
372
+ </div>
373
+
374
+ <div id="method-M000003" class="method-detail">
375
+ <a name="M000003"></a>
376
+
377
+ <div class="method-heading">
378
+ <a href="#M000003" class="method-signature">
379
+ <span class="method-name">getopts</span><span class="method-args">(opts)</span>
380
+ </a>
381
+ </div>
382
+
383
+ <div class="method-description">
384
+ <p><a class="source-toggle" href="#"
385
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
386
+ <div class="method-source-code" id="M000003-source">
387
387
  <pre>
388
388
  <span class="ruby-comment cmt"># File lib/slave.rb, line 83</span>
389
389
  83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
@@ -400,27 +400,29 @@ just fork with out silly warnings
400
400
  94: <span class="ruby-comment cmt">#--}}}</span>
401
401
  95: <span class="ruby-keyword kw">end</span>
402
402
  </pre>
403
- </div>
404
- </div>
405
- </div>
406
-
407
- <div id="method-M000005" class="method-detail">
408
- <a name="M000005"></a>
409
-
410
- <div class="method-heading">
411
- <a href="#M000005" class="method-signature">
412
- <span class="method-name">new</span><span class="method-args">opts = {}, &amp;block</span>
413
- </a>
414
- </div>
415
-
416
- <div class="method-description">
417
- <p>
418
- sets up a child process serving any object as a DRb server running locally
419
- on unix domain sockets. the child process has a <a
420
- href="Slave/LifeLine.html">LifeLine</a> established between it and the
421
- parent, making it impossible for the child to outlive the parent (become a
422
- zombie). the object to serve is specfied either directly using the
423
- &#8216;object&#8217;/:object keyword
403
+ </div>
404
+ </div>
405
+ </div>
406
+
407
+ <div id="method-M000005" class="method-detail">
408
+ <a name="M000005"></a>
409
+
410
+ <div class="method-heading">
411
+ <a href="#M000005" class="method-signature">
412
+ <span class="method-name">new</span><span class="method-args">(opts = {})</span>
413
+ </a>
414
+ </div>
415
+
416
+ <div class="method-description">
417
+ <p>
418
+ sets up a child process serving any <a href="Slave.html#M000015">object</a>
419
+ as a DRb server running locally on unix domain sockets. the child process
420
+ has a <a href="Slave/LifeLine.html">LifeLine</a> established between it and
421
+ the parent, making it impossible for the child to outlive the parent
422
+ (become a zombie). the <a href="Slave.html#M000015">object</a> to serve is
423
+ specfied either directly using the &#8216;<a
424
+ href="Slave.html#M000015">object</a>&#8217;/:<a
425
+ href="Slave.html#M000015">object</a> keyword
424
426
  </p>
425
427
  <pre>
426
428
  Slave.new :object =&gt; MyServer.new
@@ -432,14 +434,17 @@ or, preferably, using the block form
432
434
  Slave.new{ MyServer.new }
433
435
  </pre>
434
436
  <p>
435
- when the block form is used the object is contructed in the child process
436
- itself. this is quite advantageous if the child object consumes resources
437
- or opens file handles (db connections, etc). by contructing the object in
438
- the child any resources are consumed from the child&#8217;s address space
439
- and things like open file handles will not be carried into subsequent child
440
- processes (via standard unix fork semantics). in the event that a block is
441
- specified but the object cannot be constructed and, instead, throws and
442
- Exception, that exception will be propogated to the parent process.
437
+ when the block form is used the <a href="Slave.html#M000015">object</a> is
438
+ contructed in the child process itself. this is quite advantageous if the
439
+ child <a href="Slave.html#M000015">object</a> consumes resources or opens
440
+ file handles (db connections, etc). by contructing the <a
441
+ href="Slave.html#M000015">object</a> in the child any resources are
442
+ consumed from the child&#8216;s address space and things like open file
443
+ handles will not be carried into subsequent child processes (via standard
444
+ unix <a href="Slave.html#M000004">fork</a> semantics). in the event that a
445
+ block is specified but the <a href="Slave.html#M000015">object</a> cannot
446
+ be constructed and, instead, throws and Exception, that exception will be
447
+ propogated to the parent process.
443
448
  </p>
444
449
  <p>
445
450
  opts may contain the following keys, as either strings or symbols
@@ -453,178 +458,180 @@ opts may contain the following keys, as either strings or symbols
453
458
  dumped : specify that the slave object should *not* be DRbUndumped (default is DRbUndumped)
454
459
  threadsafe : wrap the slave object with ThreadSafe to implement gross thread safety
455
460
  </pre>
456
- <p><a class="source-toggle" href="#"
457
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
458
- <div class="method-source-code" id="M000005-source">
461
+ <p><a class="source-toggle" href="#"
462
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
463
+ <div class="method-source-code" id="M000005-source">
459
464
  <pre>
460
- <span class="ruby-comment cmt"># File lib/slave.rb, line 321</span>
461
- 321: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
462
- 322: <span class="ruby-comment cmt">#--{{{</span>
463
- 323: <span class="ruby-identifier">getopt</span> = <span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
464
- 324:
465
- 325: <span class="ruby-ivar">@obj</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'object'</span>]
466
- 326: <span class="ruby-ivar">@socket_creation_attempts</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'socket_creation_attempts'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>(<span class="ruby-value str">'socket_creation_attempts'</span>)
467
- 327: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'debug'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>(<span class="ruby-value str">'debug'</span>)
468
- 328: <span class="ruby-ivar">@psname</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'psname'</span>]
469
- 329: <span class="ruby-ivar">@at_exit</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'at_exit'</span>]
470
- 330: <span class="ruby-ivar">@dumped</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'dumped'</span>]
471
- 331: <span class="ruby-ivar">@threadsafe</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'threadsafe'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>(<span class="ruby-value str">'threadsafe'</span>)
472
- 332:
473
- 333: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'no slave object or slave object block provided!'</span> <span class="ruby-keyword kw">if</span>
474
- 334: <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
475
- 335:
476
- 336: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">false</span>
477
- 337: <span class="ruby-ivar">@waiter</span> = <span class="ruby-ivar">@status</span> = <span class="ruby-keyword kw">nil</span>
478
- 338: <span class="ruby-ivar">@lifeline</span> = <span class="ruby-constant">LifeLine</span>.<span class="ruby-identifier">new</span>
479
- 339:
480
- 340: <span class="ruby-comment cmt"># weird syntax because dot/rdoc chokes on this!?!?</span>
481
- 341: <span class="ruby-identifier">init_failure</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
482
- 342: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
483
- 343: <span class="ruby-identifier">o</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
484
- 344: <span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">o</span>
485
- 345: <span class="ruby-identifier">attr_accessor</span> <span class="ruby-value str">'__slave_object_failure__'</span>
486
- 346: <span class="ruby-keyword kw">end</span>
487
- 347: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">__slave_object_failure__</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span> [<span class="ruby-identifier">e</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>]
488
- 348: <span class="ruby-ivar">@object</span> = <span class="ruby-identifier">o</span>
489
- 349: <span class="ruby-keyword kw">end</span>
490
- 350:
465
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 319</span>
466
+ 319: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
467
+ 320: <span class="ruby-comment cmt">#--{{{</span>
468
+ 321: <span class="ruby-identifier">getopt</span> = <span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
469
+ 322:
470
+ 323: <span class="ruby-ivar">@obj</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'object'</span>]
471
+ 324: <span class="ruby-ivar">@socket_creation_attempts</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'socket_creation_attempts'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>(<span class="ruby-value str">'socket_creation_attempts'</span>)
472
+ 325: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'debug'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>(<span class="ruby-value str">'debug'</span>)
473
+ 326: <span class="ruby-ivar">@psname</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'psname'</span>]
474
+ 327: <span class="ruby-ivar">@at_exit</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'at_exit'</span>]
475
+ 328: <span class="ruby-ivar">@dumped</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'dumped'</span>]
476
+ 329: <span class="ruby-ivar">@threadsafe</span> = <span class="ruby-identifier">getopt</span>[<span class="ruby-value str">'threadsafe'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>(<span class="ruby-value str">'threadsafe'</span>)
477
+ 330:
478
+ 331: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'no slave object or slave object block provided!'</span> <span class="ruby-keyword kw">if</span>
479
+ 332: <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
480
+ 333:
481
+ 334: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">false</span>
482
+ 335: <span class="ruby-ivar">@waiter</span> = <span class="ruby-ivar">@status</span> = <span class="ruby-keyword kw">nil</span>
483
+ 336: <span class="ruby-ivar">@lifeline</span> = <span class="ruby-constant">LifeLine</span>.<span class="ruby-identifier">new</span>
484
+ 337:
485
+ 338: <span class="ruby-comment cmt"># weird syntax because dot/rdoc chokes on this!?!?</span>
486
+ 339: <span class="ruby-identifier">init_failure</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
487
+ 340: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%Q[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
488
+ 341: <span class="ruby-identifier">o</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
489
+ 342: <span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">o</span>
490
+ 343: <span class="ruby-identifier">attr_accessor</span> <span class="ruby-value str">'__slave_object_failure__'</span>
491
+ 344: <span class="ruby-keyword kw">end</span>
492
+ 345: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">__slave_object_failure__</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span> [<span class="ruby-identifier">e</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>]
493
+ 346: <span class="ruby-ivar">@object</span> = <span class="ruby-identifier">o</span>
494
+ 347: <span class="ruby-keyword kw">end</span>
495
+ 348:
496
+ 349: <span class="ruby-comment cmt">#</span>
497
+ 350: <span class="ruby-comment cmt"># child</span>
491
498
  351: <span class="ruby-comment cmt">#</span>
492
- 352: <span class="ruby-comment cmt"># child</span>
493
- 353: <span class="ruby-comment cmt">#</span>
494
- 354: <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>))
495
- 355: <span class="ruby-identifier">e</span> = <span class="ruby-keyword kw">nil</span>
496
- 356: <span class="ruby-keyword kw">begin</span>
497
- 357: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">at_exit</span>{ <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">exit!</span> }
498
- 358: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">catch</span>
499
- 359:
500
- 360: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@obj</span>
501
- 361: <span class="ruby-ivar">@object</span> = <span class="ruby-ivar">@obj</span>
502
- 362: <span class="ruby-keyword kw">else</span>
503
- 363: <span class="ruby-keyword kw">begin</span>
504
- 364: <span class="ruby-ivar">@object</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
505
- 365: <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>
506
- 366: <span class="ruby-identifier">init_failure</span>[<span class="ruby-identifier">e</span>]
507
- 367: <span class="ruby-keyword kw">end</span>
508
- 368: <span class="ruby-keyword kw">end</span>
509
- 369:
510
- 370: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@obj</span>
511
- 371: <span class="ruby-keyword kw">begin</span>
512
- 372: <span class="ruby-identifier">block</span>[<span class="ruby-ivar">@obj</span>]
513
- 373: <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>
514
- 374: <span class="ruby-identifier">init_failure</span>[<span class="ruby-identifier">e</span>]
515
- 375: <span class="ruby-keyword kw">end</span>
516
- 376: <span class="ruby-keyword kw">end</span>
499
+ 352: <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>))
500
+ 353: <span class="ruby-identifier">e</span> = <span class="ruby-keyword kw">nil</span>
501
+ 354: <span class="ruby-keyword kw">begin</span>
502
+ 355: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">at_exit</span>{ <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">exit!</span> }
503
+ 356: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">catch</span>
504
+ 357:
505
+ 358: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@obj</span>
506
+ 359: <span class="ruby-ivar">@object</span> = <span class="ruby-ivar">@obj</span>
507
+ 360: <span class="ruby-keyword kw">else</span>
508
+ 361: <span class="ruby-keyword kw">begin</span>
509
+ 362: <span class="ruby-ivar">@object</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
510
+ 363: <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>
511
+ 364: <span class="ruby-identifier">init_failure</span>[<span class="ruby-identifier">e</span>]
512
+ 365: <span class="ruby-keyword kw">end</span>
513
+ 366: <span class="ruby-keyword kw">end</span>
514
+ 367:
515
+ 368: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@obj</span>
516
+ 369: <span class="ruby-keyword kw">begin</span>
517
+ 370: <span class="ruby-identifier">block</span>[<span class="ruby-ivar">@obj</span>]
518
+ 371: <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>
519
+ 372: <span class="ruby-identifier">init_failure</span>[<span class="ruby-identifier">e</span>]
520
+ 373: <span class="ruby-keyword kw">end</span>
521
+ 374: <span class="ruby-keyword kw">end</span>
522
+ 375:
523
+ 376: <span class="ruby-identifier">$0</span> = (<span class="ruby-ivar">@psname</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">gen_psname</span>(<span class="ruby-ivar">@object</span>))
517
524
  377:
518
- 378: <span class="ruby-identifier">$0</span> = (<span class="ruby-ivar">@psname</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">gen_psname</span>(<span class="ruby-ivar">@object</span>))
519
- 379:
520
- 380: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@dumped</span> <span class="ruby-keyword kw">or</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'__slave_object_failure__'</span>)
521
- 381: <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">DRbUndumped</span>
522
- 382: <span class="ruby-keyword kw">end</span>
523
- 383:
524
- 384: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@threadsafe</span>
525
- 385: <span class="ruby-ivar">@object</span> = <span class="ruby-constant">ThreadSafe</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@object</span>
526
- 386: <span class="ruby-keyword kw">end</span>
527
- 387:
528
- 388: <span class="ruby-ivar">@ppid</span>, <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>, <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
529
- 389: <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword kw">nil</span>
530
- 390: <span class="ruby-ivar">@uri</span> = <span class="ruby-keyword kw">nil</span>
525
+ 378: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@dumped</span> <span class="ruby-keyword kw">or</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'__slave_object_failure__'</span>)
526
+ 379: <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">DRbUndumped</span>
527
+ 380: <span class="ruby-keyword kw">end</span>
528
+ 381:
529
+ 382: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@threadsafe</span>
530
+ 383: <span class="ruby-ivar">@object</span> = <span class="ruby-constant">ThreadSafe</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@object</span>
531
+ 384: <span class="ruby-keyword kw">end</span>
532
+ 385:
533
+ 386: <span class="ruby-ivar">@ppid</span>, <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>, <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
534
+ 387: <span class="ruby-ivar">@socket</span> = <span class="ruby-keyword kw">nil</span>
535
+ 388: <span class="ruby-ivar">@uri</span> = <span class="ruby-keyword kw">nil</span>
536
+ 389:
537
+ 390: <span class="ruby-identifier">tmpdir</span>, <span class="ruby-identifier">basename</span> = <span class="ruby-constant">Dir</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmpdir</span>, <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">basename</span>(<span class="ruby-ivar">@psname</span>)
531
538
  391:
532
- 392: <span class="ruby-identifier">tmpdir</span>, <span class="ruby-identifier">basename</span> = <span class="ruby-constant">Dir</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmpdir</span>, <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">basename</span>(<span class="ruby-ivar">@psname</span>)
533
- 393:
534
- 394: <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>
535
- 395: <span class="ruby-identifier">se</span> = <span class="ruby-keyword kw">nil</span>
536
- 396: <span class="ruby-keyword kw">begin</span>
537
- 397: <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 }_#{ rand }&quot;</span>)
538
- 398: <span class="ruby-identifier">u</span> = <span class="ruby-node">&quot;drbunix://#{ s }&quot;</span>
539
- 399: <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-ivar">@object</span>
540
- 400: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">s</span>
541
- 401: <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">u</span>
542
- 402: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - socket &lt;#{ @socket }&gt;&quot;</span> }
543
- 403: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - uri &lt;#{ @uri }&gt;&quot;</span> }
544
- 404: <span class="ruby-keyword kw">break</span>
545
- 405: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EADDRINUSE</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">se</span>
546
- 406: <span class="ruby-keyword kw">nil</span>
547
- 407: <span class="ruby-keyword kw">end</span>
548
- 408: <span class="ruby-keyword kw">end</span>
549
- 409:
550
- 410: <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>
551
- 411: <span class="ruby-identifier">trap</span>(<span class="ruby-value str">'SIGUSR2'</span>) <span class="ruby-keyword kw">do</span>
552
- 412: <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>
553
- 413: <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>
554
- 414: <span class="ruby-identifier">exit</span>
555
- 415: <span class="ruby-keyword kw">end</span>
556
- 416:
557
- 417: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@socket</span>
558
- 418: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">cling</span>
559
- 419: <span class="ruby-keyword kw">else</span>
560
- 420: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">release</span>
561
- 421: <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;slave(#{ $$ }) could not create socket!&quot;</span>
562
- 422: <span class="ruby-identifier">exit</span>
563
- 423: <span class="ruby-keyword kw">end</span>
564
- 424: <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>
565
- 425: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
566
- 426: <span class="ruby-keyword kw">ensure</span>
567
- 427: <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>
568
- 428: <span class="ruby-identifier">exit</span>(<span class="ruby-identifier">status</span>)
569
- 429: <span class="ruby-keyword kw">end</span>
539
+ 392: <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>
540
+ 393: <span class="ruby-identifier">se</span> = <span class="ruby-keyword kw">nil</span>
541
+ 394: <span class="ruby-keyword kw">begin</span>
542
+ 395: <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 }_#{ rand }&quot;</span>)
543
+ 396: <span class="ruby-identifier">u</span> = <span class="ruby-node">&quot;drbunix://#{ s }&quot;</span>
544
+ 397: <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-ivar">@object</span>
545
+ 398: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">s</span>
546
+ 399: <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">u</span>
547
+ 400: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - socket &lt;#{ @socket }&gt;&quot;</span> }
548
+ 401: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;child - uri &lt;#{ @uri }&gt;&quot;</span> }
549
+ 402: <span class="ruby-keyword kw">break</span>
550
+ 403: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EADDRINUSE</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">se</span>
551
+ 404: <span class="ruby-keyword kw">nil</span>
552
+ 405: <span class="ruby-keyword kw">end</span>
553
+ 406: <span class="ruby-keyword kw">end</span>
554
+ 407:
555
+ 408: <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>
556
+ 409: <span class="ruby-identifier">trap</span>(<span class="ruby-value str">'SIGUSR2'</span>) <span class="ruby-keyword kw">do</span>
557
+ 410: <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>
558
+ 411: <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>
559
+ 412: <span class="ruby-identifier">exit</span>
560
+ 413: <span class="ruby-keyword kw">end</span>
561
+ 414:
562
+ 415: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@socket</span>
563
+ 416: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">cling</span>
564
+ 417: <span class="ruby-keyword kw">else</span>
565
+ 418: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">release</span>
566
+ 419: <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;slave(#{ $$ }) could not create socket!&quot;</span>
567
+ 420: <span class="ruby-identifier">exit</span>
568
+ 421: <span class="ruby-keyword kw">end</span>
569
+ 422: <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>
570
+ 423: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%Q[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
571
+ 424: <span class="ruby-keyword kw">ensure</span>
572
+ 425: <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>
573
+ 426: <span class="ruby-identifier">exit</span>(<span class="ruby-identifier">status</span>)
574
+ 427: <span class="ruby-keyword kw">end</span>
575
+ 428: <span class="ruby-comment cmt">#</span>
576
+ 429: <span class="ruby-comment cmt"># parent </span>
570
577
  430: <span class="ruby-comment cmt">#</span>
571
- 431: <span class="ruby-comment cmt"># parent </span>
572
- 432: <span class="ruby-comment cmt">#</span>
573
- 433: <span class="ruby-keyword kw">else</span>
574
- 434: <span class="ruby-identifier">detach</span>
575
- 435: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">throw</span>
576
- 436:
577
- 437: <span class="ruby-identifier">buf</span> = <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">gets</span>
578
- 438: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;failed to find slave socket&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span>
579
- 439: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">strip</span>
580
- 440: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - socket &lt;#{ @socket }&gt;&quot;</span> }
581
- 441:
582
- 442: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@at_exit</span>
583
- 443: <span class="ruby-ivar">@at_exit_thread</span> = <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">on_cut</span>{
584
- 444: <span class="ruby-ivar">@at_exit</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'call'</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@at_exit</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">send</span>(<span class="ruby-ivar">@at_exit</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">self</span>)
585
- 445: }
586
- 446: <span class="ruby-keyword kw">end</span>
587
- 447:
588
- 448: <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>
589
- 449: <span class="ruby-constant">Kernel</span>.<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> }
590
- 450: <span class="ruby-ivar">@uri</span> = <span class="ruby-node">&quot;drbunix://#{ socket }&quot;</span>
591
- 451: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - uri &lt;#{ @uri }&gt;&quot;</span> }
578
+ 431: <span class="ruby-keyword kw">else</span>
579
+ 432: <span class="ruby-identifier">detach</span>
580
+ 433: <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">throw</span>
581
+ 434:
582
+ 435: <span class="ruby-identifier">buf</span> = <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">gets</span>
583
+ 436: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;failed to find slave socket&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span>
584
+ 437: <span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">strip</span>
585
+ 438: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - socket &lt;#{ @socket }&gt;&quot;</span> }
586
+ 439:
587
+ 440: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@at_exit</span>
588
+ 441: <span class="ruby-ivar">@at_exit_thread</span> = <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">on_cut</span>{
589
+ 442: <span class="ruby-ivar">@at_exit</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'call'</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@at_exit</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">send</span>(<span class="ruby-ivar">@at_exit</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">self</span>)
590
+ 443: }
591
+ 444: <span class="ruby-keyword kw">end</span>
592
+ 445:
593
+ 446: <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>
594
+ 447: <span class="ruby-constant">Kernel</span>.<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> }
595
+ 448: <span class="ruby-ivar">@uri</span> = <span class="ruby-node">&quot;drbunix://#{ socket }&quot;</span>
596
+ 449: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">&quot;parent - uri &lt;#{ @uri }&gt;&quot;</span> }
597
+ 450: <span class="ruby-comment cmt">#</span>
598
+ 451: <span class="ruby-comment cmt"># starting drb on localhost avoids dns lookups!</span>
592
599
  452: <span class="ruby-comment cmt">#</span>
593
- 453: <span class="ruby-comment cmt"># starting drb on localhost avoids dns lookups!</span>
594
- 454: <span class="ruby-comment cmt">#</span>
595
- 455: <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>
596
- 456: <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>
597
- 457: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value str">'__slave_object_failure__'</span>
598
- 458: <span class="ruby-identifier">c</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">bt</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">__slave_object_failure__</span>
599
- 459: (<span class="ruby-identifier">e</span> = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">m</span>)).<span class="ruby-identifier">set_backtrace</span> <span class="ruby-identifier">bt</span>
600
- 460: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
601
- 461: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
602
- 462: <span class="ruby-keyword kw">end</span>
603
- 463: <span class="ruby-ivar">@psname</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">gen_psname</span>(<span class="ruby-ivar">@object</span>)
604
- 464: <span class="ruby-keyword kw">else</span>
605
- 465: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;failed to find slave socket &lt;#{ @socket }&gt;&quot;</span>
606
- 466: <span class="ruby-keyword kw">end</span>
607
- 467: <span class="ruby-keyword kw">end</span>
608
- 468: <span class="ruby-comment cmt">#--}}}</span>
609
- 469: <span class="ruby-keyword kw">end</span>
600
+ 453: <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>
601
+ 454: <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>
602
+ 455: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value str">'__slave_object_failure__'</span>
603
+ 456: <span class="ruby-identifier">c</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">bt</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">__slave_object_failure__</span>
604
+ 457: (<span class="ruby-identifier">e</span> = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">m</span>)).<span class="ruby-identifier">set_backtrace</span> <span class="ruby-identifier">bt</span>
605
+ 458: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">%Q[#{ e.message } (#{ e.class })\n#{ e.backtrace.join &quot;\n&quot; }]</span> }
606
+ 459: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
607
+ 460: <span class="ruby-keyword kw">end</span>
608
+ 461: <span class="ruby-ivar">@psname</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">gen_psname</span>(<span class="ruby-ivar">@object</span>)
609
+ 462: <span class="ruby-keyword kw">else</span>
610
+ 463: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;failed to find slave socket &lt;#{ @socket }&gt;&quot;</span>
611
+ 464: <span class="ruby-keyword kw">end</span>
612
+ 465: <span class="ruby-keyword kw">end</span>
613
+ 466: <span class="ruby-comment cmt">#--}}}</span>
614
+ 467: <span class="ruby-keyword kw">end</span>
610
615
  </pre>
611
- </div>
612
- </div>
613
- </div>
614
-
615
- <div id="method-M000015" class="method-detail">
616
- <a name="M000015"></a>
617
-
618
- <div class="method-heading">
619
- <a href="#M000015" class="method-signature">
620
- <span class="method-name">object</span><span class="method-args">opts = {}, &amp;b</span>
621
- </a>
622
- </div>
623
-
624
- <div class="method-description">
625
- <p>
626
- a simple convenience method which returns an <b>object</b> from another
627
- process. the object returned is the result of the supplied block. eg
616
+ </div>
617
+ </div>
618
+ </div>
619
+
620
+ <div id="method-M000015" class="method-detail">
621
+ <a name="M000015"></a>
622
+
623
+ <div class="method-heading">
624
+ <a href="#M000015" class="method-signature">
625
+ <span class="method-name">object</span><span class="method-args">(opts = {})</span>
626
+ </a>
627
+ </div>
628
+
629
+ <div class="method-description">
630
+ <p>
631
+ a simple convenience method which returns an <b><a
632
+ href="Slave.html#M000015">object</a></b> from another process. the <a
633
+ href="Slave.html#M000015">object</a> returned is the result of the supplied
634
+ block. eg
628
635
  </p>
629
636
  <pre>
630
637
  object = Slave.object{ processor_intensive_object_built_in_child_process() }
@@ -643,375 +650,343 @@ keyword
643
650
 
644
651
  object = thread.value
645
652
  </pre>
646
- <p><a class="source-toggle" href="#"
647
- onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
648
- <div class="method-source-code" id="M000015-source">
653
+ <p><a class="source-toggle" href="#"
654
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
655
+ <div class="method-source-code" id="M000015-source">
649
656
  <pre>
650
- <span class="ruby-comment cmt"># File lib/slave.rb, line 589</span>
651
- 589: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
652
- 590: <span class="ruby-comment cmt">#--{{{</span>
653
- 591: <span class="ruby-identifier">l</span> = <span class="ruby-identifier">lambda</span>{ <span class="ruby-keyword kw">begin</span>; <span class="ruby-identifier">b</span>.<span class="ruby-identifier">call</span>; <span class="ruby-keyword kw">ensure</span>; <span class="ruby-identifier">exit</span>; <span class="ruby-keyword kw">end</span> }
654
- 592:
655
- 593: <span class="ruby-identifier">async</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'async'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:async</span>)
656
- 594:
657
- 595: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'object'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:object</span>] = <span class="ruby-identifier">l</span>
658
- 596: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'dumped'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:dumped</span>] = <span class="ruby-keyword kw">true</span>
659
- 597:
660
- 598: <span class="ruby-identifier">slave</span> = <span class="ruby-constant">Slave</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">opts</span>
661
- 599:
662
- 600: <span class="ruby-identifier">async</span> <span class="ruby-value">? </span><span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{ <span class="ruby-identifier">slave</span>.<span class="ruby-identifier">object</span>.<span class="ruby-identifier">call</span> } <span class="ruby-operator">:</span> <span class="ruby-identifier">slave</span>.<span class="ruby-identifier">object</span>.<span class="ruby-identifier">call</span>
663
- 601: <span class="ruby-comment cmt">#--}}}</span>
664
- 602: <span class="ruby-keyword kw">end</span>
657
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 587</span>
658
+ 587: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
659
+ 588: <span class="ruby-comment cmt">#--{{{</span>
660
+ 589: <span class="ruby-identifier">async</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'async'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:async</span>)
661
+ 590:
662
+ 591: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'object'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:object</span>] = <span class="ruby-identifier">lambda</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
663
+ 592: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'dumped'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:dumped</span>] = <span class="ruby-keyword kw">true</span>
664
+ 593:
665
+ 594: <span class="ruby-identifier">slave</span> = <span class="ruby-constant">Slave</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">opts</span>
666
+ 595:
667
+ 596: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">slave</span><span class="ruby-operator">|</span>
668
+ 597: <span class="ruby-keyword kw">begin</span>
669
+ 598: <span class="ruby-identifier">slave</span>.<span class="ruby-identifier">object</span>.<span class="ruby-identifier">call</span>
670
+ 599: <span class="ruby-keyword kw">ensure</span>
671
+ 600: <span class="ruby-identifier">slave</span>.<span class="ruby-identifier">shutdown</span>
672
+ 601: <span class="ruby-keyword kw">end</span>
673
+ 602: <span class="ruby-keyword kw">end</span>
674
+ 603:
675
+ 604: <span class="ruby-identifier">async</span> <span class="ruby-value">? </span><span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{ <span class="ruby-identifier">value</span>[<span class="ruby-identifier">slave</span>] } <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">slave</span>]
676
+ 605: <span class="ruby-comment cmt">#--}}}</span>
677
+ 606: <span class="ruby-keyword kw">end</span>
665
678
  </pre>
666
- </div>
667
- </div>
668
- </div>
669
-
670
- <div id="method-M000016" class="method-detail">
671
- <a name="M000016"></a>
672
-
673
- <div class="method-heading">
674
- <a href="#M000016" class="method-signature">
675
- <span class="method-name">object</span><span class="method-args">opts = {}, &amp;b</span>
676
- </a>
677
- </div>
678
-
679
- <div class="method-description">
680
- <p><a class="source-toggle" href="#"
681
- onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
682
- <div class="method-source-code" id="M000016-source">
683
- <pre>
684
- <span class="ruby-comment cmt"># File lib/slave.rb, line 603</span>
685
- 603: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
686
- 604: <span class="ruby-comment cmt">#--{{{</span>
687
- 605: <span class="ruby-identifier">async</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'async'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:async</span>)
688
- 606:
689
- 607: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'object'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:object</span>] = <span class="ruby-identifier">lambda</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
690
- 608: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'dumped'</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:dumped</span>] = <span class="ruby-keyword kw">true</span>
691
- 609:
692
- 610: <span class="ruby-identifier">slave</span> = <span class="ruby-constant">Slave</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">opts</span>
693
- 611:
694
- 612: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">slave</span><span class="ruby-operator">|</span>
695
- 613: <span class="ruby-keyword kw">begin</span>
696
- 614: <span class="ruby-identifier">slave</span>.<span class="ruby-identifier">object</span>.<span class="ruby-identifier">call</span>
697
- 615: <span class="ruby-keyword kw">ensure</span>
698
- 616: <span class="ruby-identifier">slave</span>.<span class="ruby-identifier">shutdown</span>
699
- 617: <span class="ruby-keyword kw">end</span>
700
- 618: <span class="ruby-keyword kw">end</span>
701
- 619:
702
- 620: <span class="ruby-identifier">async</span> <span class="ruby-value">? </span><span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{ <span class="ruby-identifier">value</span>[<span class="ruby-identifier">slave</span>] } <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>[<span class="ruby-identifier">slave</span>]
703
- 621: <span class="ruby-comment cmt">#--}}}</span>
704
- 622: <span class="ruby-keyword kw">end</span>
705
- </pre>
706
- </div>
707
- </div>
708
- </div>
709
-
710
- <div id="method-M000001" class="method-detail">
711
- <a name="M000001"></a>
712
-
713
- <div class="method-heading">
714
- <a href="#M000001" class="method-signature">
715
- <span class="method-name">version</span><span class="method-args">()</span>
716
- </a>
717
- </div>
718
-
719
- <div class="method-description">
720
- <p><a class="source-toggle" href="#"
721
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
722
- <div class="method-source-code" id="M000001-source">
679
+ </div>
680
+ </div>
681
+ </div>
682
+
683
+ <div id="method-M000001" class="method-detail">
684
+ <a name="M000001"></a>
685
+
686
+ <div class="method-heading">
687
+ <a href="#M000001" class="method-signature">
688
+ <span class="method-name">version</span><span class="method-args">()</span>
689
+ </a>
690
+ </div>
691
+
692
+ <div class="method-description">
693
+ <p><a class="source-toggle" href="#"
694
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
695
+ <div class="method-source-code" id="M000001-source">
723
696
  <pre>
724
697
  <span class="ruby-comment cmt"># File lib/slave.rb, line 44</span>
725
698
  44: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>() <span class="ruby-constant">VERSION</span> <span class="ruby-keyword kw">end</span>
726
699
  </pre>
727
- </div>
728
- </div>
729
- </div>
730
-
731
- <h2 class="section-bar">Public Instance methods</h2>
732
-
733
- <div id="method-M000012" class="method-detail">
734
- <a name="M000012"></a>
735
-
736
- <div class="method-heading">
737
- <a href="#M000012" class="method-signature">
738
- <span class="method-name">default</span><span class="method-args">key</span>
739
- </a>
740
- </div>
741
-
742
- <div class="method-description">
743
- <p>
700
+ </div>
701
+ </div>
702
+ </div>
703
+
704
+ <h3 class="section-bar">Public Instance methods</h3>
705
+
706
+ <div id="method-M000012" class="method-detail">
707
+ <a name="M000012"></a>
708
+
709
+ <div class="method-heading">
710
+ <a href="#M000012" class="method-signature">
711
+ <span class="method-name">default</span><span class="method-args">(key)</span>
712
+ </a>
713
+ </div>
714
+
715
+ <div class="method-description">
716
+ <p>
744
717
  see docs for <a href="Slave.html#M000002">Slave.default</a>
745
718
  </p>
746
- <p><a class="source-toggle" href="#"
747
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
748
- <div class="method-source-code" id="M000012-source">
719
+ <p><a class="source-toggle" href="#"
720
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
721
+ <div class="method-source-code" id="M000012-source">
749
722
  <pre>
750
- <span class="ruby-comment cmt"># File lib/slave.rb, line 548</span>
751
- 548: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span> <span class="ruby-identifier">key</span>
752
- 549: <span class="ruby-comment cmt">#--{{{</span>
753
- 550: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">default</span> <span class="ruby-identifier">key</span>
754
- 551: <span class="ruby-comment cmt">#--}}}</span>
755
- 552: <span class="ruby-keyword kw">end</span>
723
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 546</span>
724
+ 546: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span> <span class="ruby-identifier">key</span>
725
+ 547: <span class="ruby-comment cmt">#--{{{</span>
726
+ 548: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">default</span> <span class="ruby-identifier">key</span>
727
+ 549: <span class="ruby-comment cmt">#--}}}</span>
728
+ 550: <span class="ruby-keyword kw">end</span>
756
729
  </pre>
757
- </div>
758
- </div>
759
- </div>
760
-
761
- <div id="method-M000006" class="method-detail">
762
- <a name="M000006"></a>
763
-
764
- <div class="method-heading">
765
- <a href="#M000006" class="method-signature">
766
- <span class="method-name">detach</span><span class="method-args">()</span>
767
- </a>
768
- </div>
769
-
770
- <div class="method-description">
771
- <p>
730
+ </div>
731
+ </div>
732
+ </div>
733
+
734
+ <div id="method-M000006" class="method-detail">
735
+ <a name="M000006"></a>
736
+
737
+ <div class="method-heading">
738
+ <a href="#M000006" class="method-signature">
739
+ <span class="method-name">detach</span><span class="method-args">()</span>
740
+ </a>
741
+ </div>
742
+
743
+ <div class="method-description">
744
+ <p>
772
745
  starts a thread to collect the child status and sets up at_exit handler to
773
746
  prevent zombies. the at_exit handler is canceled if the thread is able to
774
747
  collect the status
775
748
  </p>
776
- <p><a class="source-toggle" href="#"
777
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
778
- <div class="method-source-code" id="M000006-source">
749
+ <p><a class="source-toggle" href="#"
750
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
751
+ <div class="method-source-code" id="M000006-source">
779
752
  <pre>
780
- <span class="ruby-comment cmt"># File lib/slave.rb, line 475</span>
781
- 475: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">detach</span>
782
- 476: <span class="ruby-comment cmt">#--{{{</span>
783
- 477: <span class="ruby-identifier">reap</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cid</span><span class="ruby-operator">|</span>
784
- 478: <span class="ruby-keyword kw">begin</span>
785
- 479: <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-identifier">cid</span>).<span class="ruby-identifier">last</span>
786
- 480: <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>
787
- 481: <span class="ruby-identifier">m</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">b</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
788
- 482: <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;#{ m } (#{ c })\n#{ b }&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECHILD</span>
789
- 483: <span class="ruby-keyword kw">end</span>
790
- 484: <span class="ruby-keyword kw">end</span>
791
- 485:
792
- 486: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">at_exit</span> <span class="ruby-keyword kw">do</span>
793
- 487: <span class="ruby-identifier">shutdown</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
794
- 488: <span class="ruby-identifier">reap</span>[<span class="ruby-ivar">@pid</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
795
- 489: <span class="ruby-keyword kw">end</span>
796
- 490:
797
- 491: <span class="ruby-ivar">@waiter</span> =
798
- 492: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
799
- 493: <span class="ruby-keyword kw">begin</span>
800
- 494: <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>
801
- 495: <span class="ruby-keyword kw">ensure</span>
802
- 496: <span class="ruby-identifier">reap</span> = <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">cid</span><span class="ruby-operator">|</span> <span class="ruby-value str">'no-op'</span> }
803
- 497: <span class="ruby-keyword kw">end</span>
804
- 498: <span class="ruby-keyword kw">end</span>
805
- 499: <span class="ruby-comment cmt">#--}}}</span>
806
- 500: <span class="ruby-keyword kw">end</span>
753
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 473</span>
754
+ 473: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">detach</span>
755
+ 474: <span class="ruby-comment cmt">#--{{{</span>
756
+ 475: <span class="ruby-identifier">reap</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cid</span><span class="ruby-operator">|</span>
757
+ 476: <span class="ruby-keyword kw">begin</span>
758
+ 477: <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-identifier">cid</span>).<span class="ruby-identifier">last</span>
759
+ 478: <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>
760
+ 479: <span class="ruby-identifier">m</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">b</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
761
+ 480: <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;#{ m } (#{ c })\n#{ b }&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECHILD</span>
762
+ 481: <span class="ruby-keyword kw">end</span>
763
+ 482: <span class="ruby-keyword kw">end</span>
764
+ 483:
765
+ 484: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">at_exit</span> <span class="ruby-keyword kw">do</span>
766
+ 485: <span class="ruby-identifier">shutdown</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
767
+ 486: <span class="ruby-identifier">reap</span>[<span class="ruby-ivar">@pid</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
768
+ 487: <span class="ruby-keyword kw">end</span>
769
+ 488:
770
+ 489: <span class="ruby-ivar">@waiter</span> =
771
+ 490: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
772
+ 491: <span class="ruby-keyword kw">begin</span>
773
+ 492: <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>
774
+ 493: <span class="ruby-keyword kw">ensure</span>
775
+ 494: <span class="ruby-identifier">reap</span> = <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">cid</span><span class="ruby-operator">|</span> <span class="ruby-value str">'no-op'</span> }
776
+ 495: <span class="ruby-keyword kw">end</span>
777
+ 496: <span class="ruby-keyword kw">end</span>
778
+ 497: <span class="ruby-comment cmt">#--}}}</span>
779
+ 498: <span class="ruby-keyword kw">end</span>
807
780
  </pre>
808
- </div>
809
- </div>
810
- </div>
811
-
812
- <div id="method-M000011" class="method-detail">
813
- <a name="M000011"></a>
814
-
815
- <div class="method-heading">
816
- <a href="#M000011" class="method-signature">
817
- <span class="method-name">gen_psname</span><span class="method-args">obj</span>
818
- </a>
819
- </div>
820
-
821
- <div class="method-description">
822
- <p>
823
- generate a default name to appear in ps/top
781
+ </div>
782
+ </div>
783
+ </div>
784
+
785
+ <div id="method-M000011" class="method-detail">
786
+ <a name="M000011"></a>
787
+
788
+ <div class="method-heading">
789
+ <a href="#M000011" class="method-signature">
790
+ <span class="method-name">gen_psname</span><span class="method-args">(obj)</span>
791
+ </a>
792
+ </div>
793
+
794
+ <div class="method-description">
795
+ <p>
796
+ generate a <a href="Slave.html#M000002">default</a> name to appear in
797
+ ps/top
824
798
  </p>
825
- <p><a class="source-toggle" href="#"
826
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
827
- <div class="method-source-code" id="M000011-source">
799
+ <p><a class="source-toggle" href="#"
800
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
801
+ <div class="method-source-code" id="M000011-source">
828
802
  <pre>
829
- <span class="ruby-comment cmt"># File lib/slave.rb, line 540</span>
830
- 540: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gen_psname</span> <span class="ruby-identifier">obj</span>
831
- 541: <span class="ruby-comment cmt">#--{{{</span>
832
- 542: <span class="ruby-node">&quot;slave_#{ obj.class }_#{ obj.object_id }_#{ Process::ppid }_#{ 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>)
833
- 543: <span class="ruby-comment cmt">#--}}}</span>
834
- 544: <span class="ruby-keyword kw">end</span>
803
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 538</span>
804
+ 538: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gen_psname</span> <span class="ruby-identifier">obj</span>
805
+ 539: <span class="ruby-comment cmt">#--{{{</span>
806
+ 540: <span class="ruby-node">&quot;slave_#{ obj.class }_#{ obj.object_id }_#{ Process::ppid }_#{ Process::pid }&quot;</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">%r/\s+/</span>,<span class="ruby-value str">'_'</span>)
807
+ 541: <span class="ruby-comment cmt">#--}}}</span>
808
+ 542: <span class="ruby-keyword kw">end</span>
835
809
  </pre>
836
- </div>
837
- </div>
838
- </div>
839
-
840
- <div id="method-M000013" class="method-detail">
841
- <a name="M000013"></a>
842
-
843
- <div class="method-heading">
844
- <a href="#M000013" class="method-signature">
845
- <span class="method-name">getopts</span><span class="method-args">opts</span>
846
- </a>
847
- </div>
848
-
849
- <div class="method-description">
850
- <p>
810
+ </div>
811
+ </div>
812
+ </div>
813
+
814
+ <div id="method-M000013" class="method-detail">
815
+ <a name="M000013"></a>
816
+
817
+ <div class="method-heading">
818
+ <a href="#M000013" class="method-signature">
819
+ <span class="method-name">getopts</span><span class="method-args">(opts)</span>
820
+ </a>
821
+ </div>
822
+
823
+ <div class="method-description">
824
+ <p>
851
825
  see docs for <a href="Slave.html#M000003">Slave.getopts</a>
852
826
  </p>
853
- <p><a class="source-toggle" href="#"
854
- onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
855
- <div class="method-source-code" id="M000013-source">
827
+ <p><a class="source-toggle" href="#"
828
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
829
+ <div class="method-source-code" id="M000013-source">
856
830
  <pre>
857
- <span class="ruby-comment cmt"># File lib/slave.rb, line 556</span>
858
- 556: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
859
- 557: <span class="ruby-comment cmt">#--{{{</span>
860
- 558: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
861
- 559: <span class="ruby-comment cmt">#--}}}</span>
862
- 560: <span class="ruby-keyword kw">end</span>
831
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 554</span>
832
+ 554: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
833
+ 555: <span class="ruby-comment cmt">#--{{{</span>
834
+ 556: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">getopts</span> <span class="ruby-identifier">opts</span>
835
+ 557: <span class="ruby-comment cmt">#--}}}</span>
836
+ 558: <span class="ruby-keyword kw">end</span>
863
837
  </pre>
864
- </div>
865
- </div>
866
- </div>
867
-
868
- <div id="method-M000009" class="method-detail">
869
- <a name="M000009"></a>
870
-
871
- <div class="method-heading">
872
- <a href="#M000009" class="method-signature">
873
- <span class="method-name">shutdown</span><span class="method-args">opts = {}</span>
874
- </a>
875
- </div>
876
-
877
- <div class="method-description">
878
- <p>
838
+ </div>
839
+ </div>
840
+ </div>
841
+
842
+ <div id="method-M000009" class="method-detail">
843
+ <a name="M000009"></a>
844
+
845
+ <div class="method-heading">
846
+ <a href="#M000009" class="method-signature">
847
+ <span class="method-name">shutdown</span><span class="method-args">(opts = {})</span>
848
+ </a>
849
+ </div>
850
+
851
+ <div class="method-description">
852
+ <p>
879
853
  cuts the lifeline and kills the child process - give the key
880
854
  &#8216;quiet&#8217; to ignore errors shutting down, including having
881
- already shutdown
855
+ already <a href="Slave.html#M000009">shutdown</a>
882
856
  </p>
883
- <p><a class="source-toggle" href="#"
884
- onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
885
- <div class="method-source-code" id="M000009-source">
857
+ <p><a class="source-toggle" href="#"
858
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
859
+ <div class="method-source-code" id="M000009-source">
886
860
  <pre>
887
- <span class="ruby-comment cmt"># File lib/slave.rb, line 519</span>
888
- 519: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown</span> <span class="ruby-identifier">opts</span> = {}
889
- 520: <span class="ruby-comment cmt">#--{{{</span>
890
- 521: <span class="ruby-identifier">quiet</span> = <span class="ruby-identifier">getopts</span>(<span class="ruby-identifier">opts</span>)[<span class="ruby-value str">'quiet'</span>]
891
- 522: <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> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">quiet</span>
892
- 523: <span class="ruby-keyword kw">begin</span>; <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-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>; <span class="ruby-keyword kw">end</span>
893
- 524: <span class="ruby-keyword kw">begin</span>; <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">cut</span>; <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>; <span class="ruby-keyword kw">end</span>
894
- 525: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">quiet</span>
895
- 526: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">true</span>
896
- 527: <span class="ruby-comment cmt">#--}}}</span>
897
- 528: <span class="ruby-keyword kw">end</span>
861
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 517</span>
862
+ 517: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown</span> <span class="ruby-identifier">opts</span> = {}
863
+ 518: <span class="ruby-comment cmt">#--{{{</span>
864
+ 519: <span class="ruby-identifier">quiet</span> = <span class="ruby-identifier">getopts</span>(<span class="ruby-identifier">opts</span>)[<span class="ruby-value str">'quiet'</span>]
865
+ 520: <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> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">quiet</span>
866
+ 521: <span class="ruby-keyword kw">begin</span>; <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-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>; <span class="ruby-keyword kw">end</span>
867
+ 522: <span class="ruby-keyword kw">begin</span>; <span class="ruby-ivar">@lifeline</span>.<span class="ruby-identifier">cut</span>; <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>; <span class="ruby-keyword kw">end</span>
868
+ 523: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">quiet</span>
869
+ 524: <span class="ruby-ivar">@shutdown</span> = <span class="ruby-keyword kw">true</span>
870
+ 525: <span class="ruby-comment cmt">#--}}}</span>
871
+ 526: <span class="ruby-keyword kw">end</span>
898
872
  </pre>
899
- </div>
900
- </div>
901
- </div>
902
-
903
- <div id="method-M000010" class="method-detail">
904
- <a name="M000010"></a>
905
-
906
- <div class="method-heading">
907
- <a href="#M000010" class="method-signature">
908
- <span class="method-name">shutdown?</span><span class="method-args">()</span>
909
- </a>
910
- </div>
911
-
912
- <div class="method-description">
913
- <p>
873
+ </div>
874
+ </div>
875
+ </div>
876
+
877
+ <div id="method-M000010" class="method-detail">
878
+ <a name="M000010"></a>
879
+
880
+ <div class="method-heading">
881
+ <a href="#M000010" class="method-signature">
882
+ <span class="method-name">shutdown?</span><span class="method-args">()</span>
883
+ </a>
884
+ </div>
885
+
886
+ <div class="method-description">
887
+ <p>
914
888
  true
915
889
  </p>
916
- <p><a class="source-toggle" href="#"
917
- onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
918
- <div class="method-source-code" id="M000010-source">
890
+ <p><a class="source-toggle" href="#"
891
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
892
+ <div class="method-source-code" id="M000010-source">
919
893
  <pre>
920
- <span class="ruby-comment cmt"># File lib/slave.rb, line 532</span>
921
- 532: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown?</span>
922
- 533: <span class="ruby-comment cmt">#--{{{</span>
923
- 534: <span class="ruby-ivar">@shutdown</span>
924
- 535: <span class="ruby-comment cmt">#--}}}</span>
925
- 536: <span class="ruby-keyword kw">end</span>
894
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 530</span>
895
+ 530: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown?</span>
896
+ 531: <span class="ruby-comment cmt">#--{{{</span>
897
+ 532: <span class="ruby-ivar">@shutdown</span>
898
+ 533: <span class="ruby-comment cmt">#--}}}</span>
899
+ 534: <span class="ruby-keyword kw">end</span>
926
900
  </pre>
927
- </div>
928
- </div>
929
- </div>
930
-
931
- <div id="method-M000014" class="method-detail">
932
- <a name="M000014"></a>
933
-
934
- <div class="method-heading">
935
- <a href="#M000014" class="method-signature">
936
- <span class="method-name">trace</span><span class="method-args">() {|| ...}</span>
937
- </a>
938
- </div>
939
-
940
- <div class="method-description">
941
- <p>
901
+ </div>
902
+ </div>
903
+ </div>
904
+
905
+ <div id="method-M000014" class="method-detail">
906
+ <a name="M000014"></a>
907
+
908
+ <div class="method-heading">
909
+ <a href="#M000014" class="method-signature">
910
+ <span class="method-name">trace</span><span class="method-args">() {|| ...}</span>
911
+ </a>
912
+ </div>
913
+
914
+ <div class="method-description">
915
+ <p>
942
916
  debugging output - ENV[&#8216;SLAVE_DEBUG&#8217;]=1 to enable
943
917
  </p>
944
- <p><a class="source-toggle" href="#"
945
- onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
946
- <div class="method-source-code" id="M000014-source">
918
+ <p><a class="source-toggle" href="#"
919
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
920
+ <div class="method-source-code" id="M000014-source">
947
921
  <pre>
948
- <span class="ruby-comment cmt"># File lib/slave.rb, line 564</span>
949
- 564: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
950
- 565: <span class="ruby-comment cmt">#--{{{</span>
951
- 566: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span>
952
- 567: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-keyword kw">yield</span>
953
- 568: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">flush</span>
954
- 569: <span class="ruby-keyword kw">end</span>
955
- 570: <span class="ruby-comment cmt">#--}}}</span>
956
- 571: <span class="ruby-keyword kw">end</span>
922
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 562</span>
923
+ 562: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
924
+ 563: <span class="ruby-comment cmt">#--{{{</span>
925
+ 564: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span>
926
+ 565: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-keyword kw">yield</span>
927
+ 566: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">flush</span>
928
+ 567: <span class="ruby-keyword kw">end</span>
929
+ 568: <span class="ruby-comment cmt">#--}}}</span>
930
+ 569: <span class="ruby-keyword kw">end</span>
957
931
  </pre>
958
- </div>
959
- </div>
960
- </div>
961
-
962
- <div id="method-M000007" class="method-detail">
963
- <a name="M000007"></a>
964
-
965
- <div class="method-heading">
966
- <a href="#M000007" class="method-signature">
967
- <span class="method-name">wait</span><span class="method-args">opts = {}, &amp;b</span>
968
- </a>
969
- </div>
970
-
971
- <div class="method-description">
972
- <p>
973
- wait for slave to finish. if the keyword &#8216;non_block&#8217;=&gt;true
974
- is given a thread is returned to do the waiting in an async fashion. eg
932
+ </div>
933
+ </div>
934
+ </div>
935
+
936
+ <div id="method-M000007" class="method-detail">
937
+ <a name="M000007"></a>
938
+
939
+ <div class="method-heading">
940
+ <a href="#M000007" class="method-signature">
941
+ <span class="method-name">wait</span><span class="method-args">(opts = {})</span>
942
+ </a>
943
+ </div>
944
+
945
+ <div class="method-description">
946
+ <p>
947
+ <a href="Slave.html#M000007">wait</a> for slave to finish. if the keyword
948
+ &#8216;non_block&#8217;=&gt;true is given a thread is returned to do the
949
+ waiting in an async fashion. eg
975
950
  </p>
976
951
  <pre>
977
952
  thread = slave.wait(:non_block=&gt;true){|value| &quot;background &lt;#{ value }&gt;&quot;}
978
953
  </pre>
979
- <p><a class="source-toggle" href="#"
980
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
981
- <div class="method-source-code" id="M000007-source">
954
+ <p><a class="source-toggle" href="#"
955
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
956
+ <div class="method-source-code" id="M000007-source">
982
957
  <pre>
983
- <span class="ruby-comment cmt"># File lib/slave.rb, line 507</span>
984
- 507: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
985
- 508: <span class="ruby-comment cmt">#--{{{</span>
986
- 509: <span class="ruby-identifier">b</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">exit_status</span><span class="ruby-operator">|</span>}
987
- 510: <span class="ruby-identifier">non_block</span> = <span class="ruby-identifier">getopts</span>(<span class="ruby-identifier">opts</span>)[<span class="ruby-value str">'non_block'</span>]
988
- 511: <span class="ruby-identifier">non_block</span> <span class="ruby-value">? </span><span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{ <span class="ruby-identifier">b</span>[ <span class="ruby-ivar">@waiter</span>.<span class="ruby-identifier">value</span> ] } <span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>[ <span class="ruby-ivar">@waiter</span>.<span class="ruby-identifier">value</span> ]
989
- 512: <span class="ruby-comment cmt">#--}}}</span>
990
- 513: <span class="ruby-keyword kw">end</span>
958
+ <span class="ruby-comment cmt"># File lib/slave.rb, line 505</span>
959
+ 505: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait</span> <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
960
+ 506: <span class="ruby-comment cmt">#--{{{</span>
961
+ 507: <span class="ruby-identifier">b</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">exit_status</span><span class="ruby-operator">|</span>}
962
+ 508: <span class="ruby-identifier">non_block</span> = <span class="ruby-identifier">getopts</span>(<span class="ruby-identifier">opts</span>)[<span class="ruby-value str">'non_block'</span>]
963
+ 509: <span class="ruby-identifier">non_block</span> <span class="ruby-value">? </span><span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{ <span class="ruby-identifier">b</span>[ <span class="ruby-ivar">@waiter</span>.<span class="ruby-identifier">value</span> ] } <span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>[ <span class="ruby-ivar">@waiter</span>.<span class="ruby-identifier">value</span> ]
964
+ 510: <span class="ruby-comment cmt">#--}}}</span>
965
+ 511: <span class="ruby-keyword kw">end</span>
991
966
  </pre>
992
- </div>
993
- </div>
994
- </div>
995
-
996
- <div id="method-M000008" class="method-detail">
997
- <a name="M000008"></a>
998
-
999
- <div class="method-heading">
1000
- <span class="method-name">wait2</span><span class="method-args">opts = {}, &amp;b</span>
1001
- </div>
1002
-
1003
- <div class="method-description">
1004
- <p>
967
+ </div>
968
+ </div>
969
+ </div>
970
+
971
+ <div id="method-M000008" class="method-detail">
972
+ <a name="M000008"></a>
973
+
974
+ <div class="method-heading">
975
+ <span class="method-name">wait2</span><span class="method-args">(opts = {})</span>
976
+ </div>
977
+
978
+ <div class="method-description">
979
+ <p>
1005
980
  Alias for <a href="Slave.html#M000007">wait</a>
1006
981
  </p>
1007
- </div>
1008
- </div>
982
+ </div>
983
+ </div>
1009
984
 
1010
985
 
1011
- </div>
986
+ </div>
1012
987
 
1013
988
 
1014
- </div>
989
+ </div>
1015
990
 
1016
991
 
1017
992
  <div id="validator-badges">