slave 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/samples/a.rb CHANGED
@@ -11,6 +11,8 @@ require 'slave'
11
11
  end
12
12
 
13
13
  slave = Slave.new :object => Server.new
14
- server = slave.object
15
14
 
15
+ server = slave.object
16
16
  p server.add_two(40) #=> 42
17
+
18
+ slave.shutdown
data/samples/f.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'slave'
2
+ #
3
+ # slaves created previously are visible to newly created slaves - in this
4
+ # example the child process of slave_a communicates directly with the child
5
+ # process of slave_a
6
+ #
7
+ slave_a = Slave.new{ Array.new }
8
+ slave_b = Slave.new{ slave_a.object }
9
+
10
+ a, b = slave_b.object, slave_a.object
11
+
12
+ b << 42
13
+ puts a #=> 42
data/samples/g.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'slave'
2
+ #
3
+ # Slave.object can used when you want to construct an object in another
4
+ # process. in otherwords you want to fork a process and retrieve a single
5
+ # returned object from that process as opposed to setting up a server.
6
+ #
7
+ this = Process.pid
8
+ that = Slave.object{ Process.pid }
9
+
10
+ p 'this' => this, 'that' => that
11
+
12
+ #
13
+ # any object can be returned and it can be returned asychronously via a thread
14
+ #
15
+ thread = Slave.object(:async => true){ sleep 2 and [ Process.pid, Time.now ] }
16
+ this = [ Process.pid, Time.now ]
17
+ that = thread.value
18
+
19
+ p 'this' => this, 'that' => that
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: slave
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2006-10-13 00:00:00.000000 -06:00
6
+ version: 1.1.0
7
+ date: 2006-11-28 00:00:00.000000 -07:00
8
8
  summary: slave
9
9
  require_paths:
10
10
  - lib
@@ -34,47 +34,43 @@ files:
34
34
  - lib
35
35
  - README
36
36
  - rdoc.cmd
37
- - slave-1.0.0.gem
38
- - doc
39
37
  - gemspec.rb
40
38
  - samples
41
39
  - README.tmpl
42
40
  - gen_readme.rb
41
+ - doc
43
42
  - test.old/slave.rb
44
43
  - lib/slave.rb
45
- - lib/slave-1.0.0.rb
46
- - doc/index.html
47
- - doc/files
48
- - doc/fr_class_index.html
44
+ - lib/slave-1.1.0.rb
45
+ - samples/a.rb
46
+ - samples/b.rb
47
+ - samples/c.rb
48
+ - samples/d.rb
49
+ - samples/e.rb
50
+ - samples/f.rb
51
+ - samples/g.rb
49
52
  - doc/created.rid
50
- - doc/fr_method_index.html
51
- - doc/fr_file_index.html
52
- - doc/rdoc-style.css
53
53
  - doc/dot
54
+ - doc/rdoc-style.css
55
+ - doc/files
54
56
  - doc/classes
57
+ - doc/fr_file_index.html
58
+ - doc/fr_class_index.html
59
+ - doc/fr_method_index.html
60
+ - doc/index.html
61
+ - doc/dot/f_0.dot
62
+ - doc/dot/f_0.jpg
63
+ - doc/dot/f_1.dot
64
+ - doc/dot/f_1.jpg
55
65
  - doc/files/lib
56
- - doc/files/VERSION.html
57
66
  - doc/files/README.html
58
67
  - doc/files/lib/slave_rb.html
59
- - doc/dot/f_2.jpg
60
- - doc/dot/f_0.dot
61
- - doc/dot/f_1.jpg
62
- - doc/dot/f_2.dot
63
- - doc/dot/f_1.dot
64
- - doc/dot/f_0.jpg
65
- - doc/classes/Slave
66
- - doc/classes/Slave.html
67
- - doc/classes/(@object = Object.new).html
68
- - doc/classes/@object.html
69
- - doc/classes/object.html
70
- - doc/classes/(o = Object.new).html
71
68
  - doc/classes/o.html
72
- - doc/classes/Slave/Heartbeat.html
73
- - samples/a.rb
74
- - samples/b.rb
75
- - samples/c.rb
76
- - samples/d.rb
77
- - samples/e.rb
69
+ - doc/classes/Slave.html
70
+ - doc/classes/Slave
71
+ - doc/classes/Slave/ThreadSafe.html
72
+ - doc/classes/Slave/LifeLine.html
73
+ - doc/classes/Slave/ThreadSafeHash.html
78
74
  test_files: []
79
75
  rdoc_options: []
80
76
  extra_rdoc_files: []
@@ -1,117 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: (@object = Object.new)</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
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <h1>(@object = Object.new) <sup class="type-note">(Class)</sup></h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>In:</strong></td>
54
- <td>
55
- <a href="../files/lib/slave_rb.html">
56
- lib/slave.rb
57
- </a>
58
- <br />
59
- </td>
60
- </tr>
61
-
62
- </table>
63
- </div>
64
- <!-- banner header -->
65
-
66
- <div id="bodyContent">
67
-
68
-
69
- <div id="contextContent">
70
- <div id="diagram">
71
- <map name="map">
72
- <area shape="RECT" coords="27,98,99,50" href="Slave.html" alt="Slave">
73
- <area shape="RECT" coords="16,108,205,16" href=".././classes" alt="(@object = Object.new).html (@object = Object.new)">
74
- </map>
75
- <img src="../dot/f_1.jpg" usemap="#map" border=0 alt="TopLevel">
76
- </div>
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
- <div id="attribute-list">
85
- <h2 class="section-bar">Attributes</h2>
86
-
87
- <div class="name-list">
88
- <table>
89
- <tr class="top-aligned-row context-row">
90
- <td class="context-item-name">__slave_object_failure__</td>
91
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
92
- <td class="context-item-desc"></td>
93
- </tr>
94
- </table>
95
- </div>
96
- </div>
97
-
98
-
99
- </div>
100
-
101
-
102
-
103
- <!-- if includes -->
104
-
105
-
106
- <!-- if method_list -->
107
-
108
-
109
- </div>
110
-
111
-
112
- <div id="validator-badges">
113
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
114
- </div>
115
-
116
- </body>
117
- </html>
@@ -1,117 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: (o = Object.new)</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
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <h1>(o = Object.new) <sup class="type-note">(Class)</sup></h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>In:</strong></td>
54
- <td>
55
- <a href="../files/lib/slave_rb.html">
56
- lib/slave.rb
57
- </a>
58
- <br />
59
- </td>
60
- </tr>
61
-
62
- </table>
63
- </div>
64
- <!-- banner header -->
65
-
66
- <div id="bodyContent">
67
-
68
-
69
- <div id="contextContent">
70
- <div id="diagram">
71
- <map name="map">
72
- <area shape="RECT" coords="123,98,195,50" href="Slave.html" alt="Slave">
73
- <area shape="RECT" coords="16,108,205,16" href=".././classes" alt="(o = Object.new).html (o = Object.new)">
74
- </map>
75
- <img src="../dot/f_1.jpg" usemap="#map" border=0 alt="TopLevel">
76
- </div>
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
- <div id="attribute-list">
85
- <h2 class="section-bar">Attributes</h2>
86
-
87
- <div class="name-list">
88
- <table>
89
- <tr class="top-aligned-row context-row">
90
- <td class="context-item-name">__slave_object_failure__</td>
91
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
92
- <td class="context-item-desc"></td>
93
- </tr>
94
- </table>
95
- </div>
96
- </div>
97
-
98
-
99
- </div>
100
-
101
-
102
-
103
- <!-- if includes -->
104
-
105
-
106
- <!-- if method_list -->
107
-
108
-
109
- </div>
110
-
111
-
112
- <div id="validator-badges">
113
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
114
- </div>
115
-
116
- </body>
117
- </html>
@@ -1,117 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: @object</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
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <h1>@object <sup class="type-note">(Class)</sup></h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>In:</strong></td>
54
- <td>
55
- <a href="../files/lib/slave_rb.html">
56
- lib/slave.rb
57
- </a>
58
- <br />
59
- </td>
60
- </tr>
61
-
62
- </table>
63
- </div>
64
- <!-- banner header -->
65
-
66
- <div id="bodyContent">
67
-
68
-
69
- <div id="contextContent">
70
- <div id="diagram">
71
- <map name="map">
72
- <area shape="RECT" coords="123,98,195,50" href=".././classes" alt="@object.html @object">
73
- <area shape="RECT" coords="27,98,99,50" href="Slave.html" alt="Slave">
74
- </map>
75
- <img src="../dot/f_1.jpg" usemap="#map" border=0 alt="TopLevel">
76
- </div>
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
- <div id="attribute-list">
85
- <h2 class="section-bar">Attributes</h2>
86
-
87
- <div class="name-list">
88
- <table>
89
- <tr class="top-aligned-row context-row">
90
- <td class="context-item-name">__slave_object_failure__</td>
91
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
92
- <td class="context-item-desc"></td>
93
- </tr>
94
- </table>
95
- </div>
96
- </div>
97
-
98
-
99
- </div>
100
-
101
-
102
-
103
- <!-- if includes -->
104
-
105
-
106
- <!-- if method_list -->
107
-
108
-
109
- </div>
110
-
111
-
112
- <div id="validator-badges">
113
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
114
- </div>
115
-
116
- </body>
117
- </html>