atomic 1.1.0-java → 1.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,7 +3,8 @@ rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
5
  - 1.8.7
6
- - jruby-18mode # JRuby in 1.8 mode
7
- - jruby-19mode # JRuby in 1.9 mode
6
+ # Because we need JDK8 to build, these are disabled temporarily
7
+ # - jruby-18mode # JRuby in 1.8 mode
8
+ # - jruby-19mode # JRuby in 1.9 mode
8
9
  - rbx-18mode
9
10
  - rbx-19mode
data/atomic.gemspec CHANGED
@@ -1,12 +1,21 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
+ # Update these to get proper version and commit history
4
+ new_version = "1.1.1"
5
+ old_version = "1.1.0"
6
+
3
7
  Gem::Specification.new do |s|
4
8
  s.name = %q{atomic}
5
- s.version = "1.1.0"
6
- s.authors = ["Charles Oliver Nutter", "MenTaLguY"]
9
+ s.version = new_version
10
+ s.authors = ["Charles Oliver Nutter", "MenTaLguY", "Sokolov Yura"]
7
11
  s.date = Time.now.strftime('%Y-%m-%d')
8
- s.description = "An atomic reference implementation for JRuby, Rubinius, and MRI"
9
- s.email = ["headius@headius.com", "mental@rydia.net"]
12
+ s.description = <<EOS
13
+ Changes in version #{new_version}:
14
+
15
+ #{`git log --oneline #{old_version}...#{new_version}`}
16
+ #{File.read('README.md')}
17
+ EOS
18
+ s.email = ["headius@headius.com", "mental@rydia.net", "funny.falcon@gmail.com"]
10
19
  s.homepage = "http://github.com/headius/ruby-atomic"
11
20
  s.require_paths = ["lib"]
12
21
  s.summary = "An atomic reference implementation for JRuby, Rubinius, and MRI"
@@ -54,7 +54,7 @@ public class AtomicReferenceLibrary implements Library {
54
54
 
55
55
  private static final ObjectAllocator JRUBYREFERENCE8_ALLOCATOR = new ObjectAllocator() {
56
56
  public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
57
- return new JRubyReference(runtime, klazz);
57
+ return new JRubyReference8(runtime, klazz);
58
58
  }
59
59
  };
60
60
 
metadata CHANGED
@@ -1,21 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
8
8
  - Charles Oliver Nutter
9
9
  - MenTaLguY
10
+ - Sokolov Yura
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2013-04-04 00:00:00.000000000 Z
14
+ date: 2013-04-05 00:00:00.000000000 Z
14
15
  dependencies: []
15
- description: An atomic reference implementation for JRuby, Rubinius, and MRI
16
+ description: |
17
+ Changes in version 1.1.1:
18
+
19
+ 2c5ab6c Include README and oneline logs in gem description.
20
+ 6aeb053 Add @funny-falcon to authors.
21
+ aa24d4d Bump version to 1.1.1.
22
+ dc327eb Merge pull request #16 from funny-falcon/patch-1
23
+ 1b68767 Fix JRUBYREFERENCE8_ALLOCATOR
24
+
25
+ atomic: An atomic reference implementation for JRuby, Rubinius, and MRI.
26
+
27
+ Summary
28
+ =======
29
+
30
+ This library provides:
31
+
32
+ * an Atomic class that guarantees atomic updates to its contained value
33
+
34
+ The Atomic class provides accessors for the contained "value" plus two update
35
+ methods:
36
+
37
+ * update will run the provided block, passing the current value and replacing
38
+ it with the block result iff the value has not been changed in the mean time.
39
+ It may run the block repeatedly if there are other concurrent updates in
40
+ progress.
41
+ * try_update will run the provided block, passing the current value and
42
+ replacing it with the block result. If the value changes before the update
43
+ can happen, it will throw Atomic::ConcurrentUpdateError.
44
+
45
+ The atomic repository is at http://github.com/headius/ruby-atomic.
46
+
47
+ Usage
48
+ =====
49
+
50
+ The simplest way to use "atomic" is to call the "update" or "try_update"
51
+ methods.
52
+
53
+ "try_update" and "update" both call the given block, passing the current
54
+ value and using the block's result as the new value. If the value is updated
55
+ by another thread before the block completes, "try update" raises a
56
+ ConcurrentUpdateError and "update" retries the block. Because "update" may call
57
+ the block several times when multiple threads are all updating the same value,
58
+ the block's logic should be kept as simple as possible.
59
+
60
+ ````ruby
61
+ require 'atomic'
62
+
63
+ my_atomic = Atomic.new(0)
64
+ my_atomic.update {|v| v + 1}
65
+ begin
66
+ my_atomic.try_update {|v| v + 1}
67
+ rescue Atomic::ConcurrentUpdateError => cue
68
+ # deal with it (retry, propagate, etc)
69
+ end
70
+ ````
71
+
72
+ It's also possible to use the regular get/set operations on the Atomic, if you
73
+ want to avoid the exception and respond to contended changes in some other way.
74
+
75
+ ````ruby
76
+ my_atomic = Atomic.new(0)
77
+ my_atomic.value # => 0
78
+ my_atomic.value = 1
79
+ my_atomic.swap(2) # => 1
80
+ my_atomic.compare_and_swap(2, 3) # => true, updated to 3
81
+ my_atomic.compare_and_swap(2, 3) # => false, current is not 2
82
+ ````
83
+
84
+ Building
85
+ ========
86
+
87
+ As of 1.1.0, JDK8 is required to build the atomic gem, since it attempts to use
88
+ the new atomic Unsafe.getAndSetObject method only in JDK8. The resulting code
89
+ should still work fine as far back as Java 5.
16
90
  email:
17
91
  - headius@headius.com
18
92
  - mental@rydia.net
93
+ - funny.falcon@gmail.com
19
94
  executables: []
20
95
  extensions: []
21
96
  extra_rdoc_files: []
@@ -51,17 +126,17 @@ rdoc_options: []
51
126
  require_paths:
52
127
  - lib
53
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
54
130
  requirements:
55
131
  - - '>='
56
132
  - !ruby/object:Gem::Version
57
133
  version: '0'
58
- none: false
59
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
60
136
  requirements:
61
137
  - - '>='
62
138
  - !ruby/object:Gem::Version
63
139
  version: '0'
64
- none: false
65
140
  requirements: []
66
141
  rubyforge_project:
67
142
  rubygems_version: 1.8.24