mailbox 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -0
- data/VERSION.yml +1 -1
- data/lib/mailbox.rb +16 -9
- data/lib/synchronized.rb +10 -2
- data/mailbox.gemspec +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -9,12 +9,14 @@ Rake::TestTask.new do |t|
|
|
9
9
|
t.libs << "test"
|
10
10
|
t.test_files = FileList['test/**/*_test.rb']
|
11
11
|
t.verbose = true
|
12
|
+
t.warning = true
|
12
13
|
end
|
13
14
|
|
14
15
|
Rake::TestTask.new("example") do |t|
|
15
16
|
t.libs << "example"
|
16
17
|
t.test_files = FileList['example/**/*_example.rb']
|
17
18
|
t.verbose = true
|
19
|
+
t.warning = true
|
18
20
|
end
|
19
21
|
|
20
22
|
Jeweler::Tasks.new do |gemspec|
|
data/VERSION.yml
CHANGED
data/lib/mailbox.rb
CHANGED
@@ -27,12 +27,12 @@ module Mailbox
|
|
27
27
|
# Used to tell +Mailbox+ that all +mailslot+
|
28
28
|
# methods should be run on the calling thread.
|
29
29
|
#
|
30
|
-
# <b>*** Intended for
|
30
|
+
# <b>*** Intended for synchronous unit testing of concurrent apps***</b>
|
31
31
|
attr_accessor :synchronous
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
35
|
-
|
35
|
+
|
36
36
|
def self.included(base)
|
37
37
|
base.extend(Mailbox::ClassMethods)
|
38
38
|
end
|
@@ -61,10 +61,10 @@ module Mailbox
|
|
61
61
|
def __fiber__
|
62
62
|
@fiber ||= __started_fiber__
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
module ClassMethods
|
66
66
|
include Synchronized::ClassMethods
|
67
|
-
|
67
|
+
|
68
68
|
# Used within +Mailbox+ module
|
69
69
|
attr_accessor :__channel_registry__
|
70
70
|
|
@@ -78,11 +78,11 @@ module Mailbox
|
|
78
78
|
@replyable = params[:replyable]
|
79
79
|
@mailslot = true
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
private
|
83
|
-
|
83
|
+
|
84
84
|
def method_added(method_name, &block)
|
85
|
-
return super unless
|
85
|
+
return super unless __mailslot__ == true
|
86
86
|
@mailslot = false
|
87
87
|
|
88
88
|
if @next_channel_name.nil?
|
@@ -96,7 +96,7 @@ module Mailbox
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def __setup_on_fiber__(method_name)
|
99
|
-
return super if
|
99
|
+
return super if __is_adding_mailbox_to_method__
|
100
100
|
|
101
101
|
alias_method :"__#{method_name}__", method_name
|
102
102
|
@is_adding_mailbox_to_method = true
|
@@ -115,8 +115,15 @@ module Mailbox
|
|
115
115
|
@replyable = nil
|
116
116
|
@next_channel_name = nil
|
117
117
|
end
|
118
|
+
|
119
|
+
def __mailslot__
|
120
|
+
@mailslot ||= false
|
121
|
+
end
|
122
|
+
|
123
|
+
def __is_adding_mailbox_to_method__
|
124
|
+
@is_adding_mailbox_to_method ||= false
|
125
|
+
end
|
118
126
|
|
119
127
|
end
|
120
128
|
|
121
129
|
end
|
122
|
-
|
data/lib/synchronized.rb
CHANGED
@@ -31,7 +31,7 @@ module Synchronized
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def method_added(method_name, &block)
|
34
|
-
return super unless
|
34
|
+
return super unless __synchronized__ == true
|
35
35
|
@synchronized = false
|
36
36
|
__synchronize__(method_name)
|
37
37
|
super
|
@@ -39,7 +39,7 @@ module Synchronized
|
|
39
39
|
|
40
40
|
|
41
41
|
def __synchronize__(method_name)
|
42
|
-
return super if
|
42
|
+
return super if __is_adding_synchronized_to_method__
|
43
43
|
|
44
44
|
alias_method :"__#{method_name}__", method_name
|
45
45
|
@is_adding_synchronized_to_method = true
|
@@ -52,6 +52,14 @@ module Synchronized
|
|
52
52
|
@is_adding_synchronized_to_method = false
|
53
53
|
end
|
54
54
|
|
55
|
+
def __synchronized__
|
56
|
+
@synchronized ||= false
|
57
|
+
end
|
58
|
+
|
59
|
+
def __is_adding_synchronized_to_method__
|
60
|
+
@is_adding_synchronized_to_method ||= false
|
61
|
+
end
|
62
|
+
|
55
63
|
end
|
56
64
|
|
57
65
|
end
|
data/mailbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mailbox}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joel Friedman", "Patrick Farley"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-10}
|
13
13
|
s.description = %q{Mailbox is a JRuby module that simplifies concurrency and is backed by JVM threads.}
|
14
14
|
s.email = %q{asher.friedman@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -60,14 +60,14 @@ requirements: []
|
|
60
60
|
authors:
|
61
61
|
- Joel Friedman
|
62
62
|
- Patrick Farley
|
63
|
-
date: 2009-11-
|
63
|
+
date: 2009-11-10 06:00:00 +00:00
|
64
64
|
platform: ruby
|
65
65
|
test_files:
|
66
66
|
- test/mailbox_test.rb
|
67
67
|
- test/synchronized_test.rb
|
68
68
|
- test/test_helper.rb
|
69
69
|
version: !ruby/object:Gem::Version
|
70
|
-
version: 0.1.
|
70
|
+
version: 0.1.4
|
71
71
|
require_paths:
|
72
72
|
- lib
|
73
73
|
dependencies:
|