atomic 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -2
- data/atomic.gemspec +13 -4
- data/ext/org/jruby/ext/atomic/AtomicReferenceLibrary.java +1 -1
- metadata +34 -4
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
|
-
|
7
|
-
- jruby-
|
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 =
|
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 =
|
9
|
-
|
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
|
57
|
+
return new JRubyReference8(runtime, klazz);
|
58
58
|
}
|
59
59
|
};
|
60
60
|
|
metadata
CHANGED
@@ -1,21 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
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-
|
14
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
14
15
|
dependencies: []
|
15
|
-
description:
|
16
|
+
description: ! "Changes in version 1.1.1:\n\n2c5ab6c Include README and oneline logs
|
17
|
+
in gem description.\n6aeb053 Add @funny-falcon to authors.\naa24d4d Bump version
|
18
|
+
to 1.1.1.\ndc327eb Merge pull request #16 from funny-falcon/patch-1\n1b68767 Fix
|
19
|
+
JRUBYREFERENCE8_ALLOCATOR\n\natomic: An atomic reference implementation for JRuby,
|
20
|
+
Rubinius, and MRI.\n\nSummary\n=======\n\nThis library provides:\n\n* an Atomic
|
21
|
+
class that guarantees atomic updates to its contained value\n\nThe Atomic class
|
22
|
+
provides accessors for the contained \"value\" plus two update\nmethods:\n\n* update
|
23
|
+
will run the provided block, passing the current value and replacing\n it with
|
24
|
+
the block result iff the value has not been changed in the mean time.\n It may
|
25
|
+
run the block repeatedly if there are other concurrent updates in\n progress.\n*
|
26
|
+
try_update will run the provided block, passing the current value and\n replacing
|
27
|
+
it with the block result. If the value changes before the update\n can happen,
|
28
|
+
it will throw Atomic::ConcurrentUpdateError.\n\nThe atomic repository is at http://github.com/headius/ruby-atomic.\n\nUsage\n=====\n\nThe
|
29
|
+
simplest way to use \"atomic\" is to call the \"update\" or \"try_update\"\nmethods.\n\n\"try_update\"
|
30
|
+
and \"update\" both call the given block, passing the current\nvalue and using the
|
31
|
+
block's result as the new value. If the value is updated\nby another thread before
|
32
|
+
the block completes, \"try update\" raises a\nConcurrentUpdateError and \"update\"
|
33
|
+
retries the block. Because \"update\" may call\nthe block several times when multiple
|
34
|
+
threads are all updating the same value,\nthe block's logic should be kept as simple
|
35
|
+
as possible.\n\n````ruby\nrequire 'atomic'\n\nmy_atomic = Atomic.new(0)\nmy_atomic.update
|
36
|
+
{|v| v + 1}\nbegin\n my_atomic.try_update {|v| v + 1}\nrescue Atomic::ConcurrentUpdateError
|
37
|
+
=> cue\n # deal with it (retry, propagate, etc)\nend\n````\n\nIt's also possible
|
38
|
+
to use the regular get/set operations on the Atomic, if you\nwant to avoid the exception
|
39
|
+
and respond to contended changes in some other way.\n\n````ruby\nmy_atomic = Atomic.new(0)\nmy_atomic.value
|
40
|
+
# => 0\nmy_atomic.value = 1\nmy_atomic.swap(2) # => 1\nmy_atomic.compare_and_swap(2,
|
41
|
+
3) # => true, updated to 3\nmy_atomic.compare_and_swap(2, 3) # => false, current
|
42
|
+
is not 2\n````\n\nBuilding\n========\n\nAs of 1.1.0, JDK8 is required to build the
|
43
|
+
atomic gem, since it attempts to use\nthe new atomic Unsafe.getAndSetObject method
|
44
|
+
only in JDK8. The resulting code\nshould still work fine as far back as Java 5.\n"
|
16
45
|
email:
|
17
46
|
- headius@headius.com
|
18
47
|
- mental@rydia.net
|
48
|
+
- funny.falcon@gmail.com
|
19
49
|
executables: []
|
20
50
|
extensions:
|
21
51
|
- ext/extconf.rb
|
@@ -64,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
94
|
version: '0'
|
65
95
|
requirements: []
|
66
96
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.8.
|
97
|
+
rubygems_version: 1.8.23
|
68
98
|
signing_key:
|
69
99
|
specification_version: 3
|
70
100
|
summary: An atomic reference implementation for JRuby, Rubinius, and MRI
|