thread_safe 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,3 +1,3 @@
1
1
  module Threadsafe
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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
- date: 2012-04-26 00:00:00.000000000 Z
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
- files:
21
- - !binary |-
22
- LmdpdGlnbm9yZQ==
23
- - !binary |-
24
- R2VtZmlsZQ==
25
- - !binary |-
26
- TElDRU5TRQ==
27
- - !binary |-
28
- UkVBRE1FLm1k
29
- - !binary |-
30
- UmFrZWZpbGU=
31
- - !binary |-
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
- post_install_message:
38
+
39
+ post_install_message:
44
40
  rdoc_options: []
45
- require_paths:
46
- - lib
47
- required_ruby_version: !ruby/object:Gem::Requirement
48
- requirements:
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
- required_rubygems_version: !ruby/object:Gem::Requirement
55
- requirements:
56
- - - ! '>='
57
- - !ruby/object:Gem::Version
58
- version: !binary |-
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
- rubyforge_project:
63
- rubygems_version: 1.8.21
64
- signing_key:
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
- - !binary |-
69
- dGVzdC90ZXN0X2FycmF5LnJi
70
- - !binary |-
71
- dGVzdC90ZXN0X2hhc2gucmI=
72
- ...
63
+ test_files:
64
+ - test/test_array.rb
65
+ - test/test_hash.rb