thread_safe 0.0.2 → 0.0.3
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/lib/thread_safe.rb +12 -0
- data/lib/thread_safe/version.rb +1 -1
- metadata +48 -55
data/lib/thread_safe.rb
CHANGED
@@ -4,15 +4,27 @@ if defined?(JRUBY_VERSION)
|
|
4
4
|
require 'jruby/synchronized'
|
5
5
|
|
6
6
|
module ThreadSafe
|
7
|
+
# A thread-safe subclass of Array. This version locks
|
8
|
+
# against the object itself for every method call,
|
9
|
+
# ensuring only one thread can be reading or writing
|
10
|
+
# at a time. This includes iteration methods like
|
11
|
+
# #each.
|
7
12
|
class Array < ::Array
|
8
13
|
include JRuby::Synchronized
|
9
14
|
end
|
10
15
|
|
16
|
+
# A thread-safe subclass of Hash. This version locks
|
17
|
+
# against the object itself for every method call,
|
18
|
+
# ensuring only one thread can be reading or writing
|
19
|
+
# at a time. This includes iteration methods like
|
20
|
+
# #each.
|
11
21
|
class Hash < ::Hash
|
12
22
|
include JRuby::Synchronized
|
13
23
|
end
|
14
24
|
end
|
15
25
|
else
|
26
|
+
# Because MRI never runs code in parallel, the existing
|
27
|
+
# non-thread-safe structures should usually work fine.
|
16
28
|
module ThreadSafe
|
17
29
|
Array = ::Array
|
18
30
|
Hash = ::Hash
|
data/lib/thread_safe/version.rb
CHANGED
metadata
CHANGED
@@ -1,72 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: thread_safe
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Charles Oliver Nutter
|
9
|
-
autorequire:
|
7
|
+
authors:
|
8
|
+
- Charles Oliver Nutter
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
12
|
+
|
13
|
+
date: 2012-04-27 00:00:00 Z
|
13
14
|
dependencies: []
|
15
|
+
|
14
16
|
description: Thread-safe collections and utilities for Ruby
|
15
|
-
email:
|
16
|
-
- headius@headius.com
|
17
|
+
email:
|
18
|
+
- headius@headius.com
|
17
19
|
executables: []
|
20
|
+
|
18
21
|
extensions: []
|
22
|
+
|
19
23
|
extra_rdoc_files: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
27
|
-
-
|
28
|
-
|
29
|
-
-
|
30
|
-
|
31
|
-
-
|
32
|
-
bGliL3RocmVhZF9zYWZlLnJi
|
33
|
-
- !binary |-
|
34
|
-
bGliL3RocmVhZF9zYWZlL3ZlcnNpb24ucmI=
|
35
|
-
- !binary |-
|
36
|
-
dGVzdC90ZXN0X2FycmF5LnJi
|
37
|
-
- !binary |-
|
38
|
-
dGVzdC90ZXN0X2hhc2gucmI=
|
39
|
-
- !binary |-
|
40
|
-
dGhyZWFkX3NhZmUuZ2Vtc3BlYw==
|
24
|
+
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- Gemfile
|
28
|
+
- LICENSE
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- lib/thread_safe.rb
|
32
|
+
- lib/thread_safe/version.rb
|
33
|
+
- test/test_array.rb
|
34
|
+
- test/test_hash.rb
|
35
|
+
- thread_safe.gemspec
|
41
36
|
homepage: https://github.com/headius/thread_safe
|
42
37
|
licenses: []
|
43
|
-
|
38
|
+
|
39
|
+
post_install_message:
|
44
40
|
rdoc_options: []
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
- - ! '>='
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: !binary |-
|
52
|
-
MA==
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
45
|
none: false
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
MA==
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
51
|
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
61
56
|
requirements: []
|
62
|
-
|
63
|
-
|
64
|
-
|
57
|
+
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.8.23
|
60
|
+
signing_key:
|
65
61
|
specification_version: 3
|
66
62
|
summary: A collection of data structures and utilities to make thread-safe programming in Ruby easier
|
67
|
-
test_files:
|
68
|
-
-
|
69
|
-
|
70
|
-
- !binary |-
|
71
|
-
dGVzdC90ZXN0X2hhc2gucmI=
|
72
|
-
...
|
63
|
+
test_files:
|
64
|
+
- test/test_array.rb
|
65
|
+
- test/test_hash.rb
|