atomic 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/atomic.gemspec +4 -3
- metadata +29 -29
data/atomic.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
# Update these to get proper version and commit history
|
4
|
-
new_version = "1.1.
|
5
|
-
old_version = "1.1.
|
4
|
+
new_version = "1.1.2"
|
5
|
+
old_version = "1.1.1"
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = %q{atomic}
|
@@ -13,8 +13,9 @@ Gem::Specification.new do |s|
|
|
13
13
|
Changes in version #{new_version}:
|
14
14
|
|
15
15
|
#{`git log --oneline #{old_version}...#{new_version}`}
|
16
|
-
#{
|
16
|
+
#{`kramdown README.md`}
|
17
17
|
EOS
|
18
|
+
puts s.description
|
18
19
|
s.email = ["headius@headius.com", "mental@rydia.net", "funny.falcon@gmail.com"]
|
19
20
|
s.homepage = "http://github.com/headius/ruby-atomic"
|
20
21
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,35 +13,35 @@ bindir: bin
|
|
13
13
|
cert_chain: []
|
14
14
|
date: 2013-04-05 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
|
-
description: ! "Changes in version 1.1.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
the block
|
33
|
-
|
34
|
-
|
35
|
-
as possible.\n\n````ruby\nrequire 'atomic'\n\nmy_atomic = Atomic.new(0)\nmy_atomic.update
|
16
|
+
description: ! "Changes in version 1.1.2:\n\nf519385 Attempting to get description
|
17
|
+
to look nice on rubygems.org.\n\n<p>atomic: An atomic reference implementation for
|
18
|
+
JRuby, Rubinius, and MRI.</p>\n\n<h1 id=\"summary\">Summary</h1>\n\n<p>This library
|
19
|
+
provides:</p>\n\n<ul>\n <li>an Atomic class that guarantees atomic updates to its
|
20
|
+
contained value</li>\n</ul>\n\n<p>The Atomic class provides accessors for the contained
|
21
|
+
“value” plus two update\nmethods:</p>\n\n<ul>\n <li>update will run the provided
|
22
|
+
block, passing the current value and replacing\nit with the block result iff the
|
23
|
+
value has not been changed in the mean time.\nIt may run the block repeatedly if
|
24
|
+
there are other concurrent updates in\nprogress.</li>\n <li>try_update will run
|
25
|
+
the provided block, passing the current value and\nreplacing it with the block result.
|
26
|
+
If the value changes before the update\ncan happen, it will throw Atomic::ConcurrentUpdateError.</li>\n</ul>\n\n<p>The
|
27
|
+
atomic repository is at http://github.com/headius/ruby-atomic.</p>\n\n<h1 id=\"usage\">Usage</h1>\n\n<p>The
|
28
|
+
simplest way to use “atomic” is to call the “update” or “try_update”\nmethods.</p>\n\n<p>“try_update”
|
29
|
+
and “update” both call the given block, passing the current\nvalue and using the
|
30
|
+
block’s result as the new value. If the value is updated\nby another thread before
|
31
|
+
the block completes, “try update” raises a\nConcurrentUpdateError and “update” retries
|
32
|
+
the block. Because “update” may call\nthe block several times when multiple threads
|
33
|
+
are all updating the same value,\nthe block’s logic should be kept as simple as
|
34
|
+
possible.</p>\n\n<p>````ruby\nrequire ‘atomic’</p>\n\n<p>my_atomic = Atomic.new(0)\nmy_atomic.update
|
36
35
|
{|v| v + 1}\nbegin\n my_atomic.try_update {|v| v + 1}\nrescue Atomic::ConcurrentUpdateError
|
37
|
-
|
38
|
-
to use the regular get/set operations on the Atomic, if you\nwant to avoid
|
39
|
-
and respond to contended changes in some other way
|
40
|
-
#
|
41
|
-
3) #
|
42
|
-
is not 2\n
|
43
|
-
atomic gem, since it attempts to use\nthe
|
44
|
-
only in JDK8. The resulting code\nshould
|
36
|
+
=> cue\n # deal with it (retry, propagate, etc)\nend\n````</p>\n\n<p>It’s also
|
37
|
+
possible to use the regular get/set operations on the Atomic, if you\nwant to avoid
|
38
|
+
the exception and respond to contended changes in some other way.</p>\n\n<p><code>ruby\nmy_atomic
|
39
|
+
= Atomic.new(0)\nmy_atomic.value # => 0\nmy_atomic.value = 1\nmy_atomic.swap(2)
|
40
|
+
# => 1\nmy_atomic.compare_and_swap(2, 3) # => true, updated to 3\nmy_atomic.compare_and_swap(2,
|
41
|
+
3) # => false, current is not 2\n</code></p>\n\n<h1 id=\"building\">Building</h1>\n\n<p>As
|
42
|
+
of 1.1.0, JDK8 is required to build the atomic gem, since it attempts to use\nthe
|
43
|
+
new atomic Unsafe.getAndSetObject method only in JDK8. The resulting code\nshould
|
44
|
+
still work fine as far back as Java 5.</p>\n\n"
|
45
45
|
email:
|
46
46
|
- headius@headius.com
|
47
47
|
- mental@rydia.net
|