atomic 1.1.16-java → 1.1.99-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +35 -6
- data/.travis.yml +20 -3
- data/Gemfile +11 -3
- data/README.md +33 -10
- data/Rakefile +2 -2
- data/atomic.gemspec +3 -2
- data/ext/atomic_reference.c +16 -3
- data/ext/extconf.rb +3 -4
- data/test/test_atomic.rb +1 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbad1a0ae7343621cc423b8fb3de68c1215f56eb
|
4
|
+
data.tar.gz: 195eff42e12848cabb09b953d7a20be891778b83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b70e8af28b679b640fcc8dfdc6128817ecf0f34b287734c00eee5aa887d447f853fd3ddfd2f8e1428900aaaf9aff48d959a401bca3f93a4886b494690b0d94
|
7
|
+
data.tar.gz: ccebeca5cdeb0127cff79d414078e12a7bba6b9459facb396820b182b44c8a664299c63bb6ff8e43f06dcc794f282066ec2e7deeecaadd2f8efc10790f7e43ea
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: YHujQy7tqpw5P0TuWjwk6Vd5Vuw8LcGvo
|
data/.gitignore
CHANGED
@@ -1,8 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
Gemfile.lock
|
2
|
+
*.gem
|
3
|
+
lib/1.8
|
4
|
+
lib/1.9
|
5
|
+
lib/2.0
|
6
|
+
.rvmrc
|
7
|
+
.ruby-version
|
8
|
+
.ruby-gemset
|
9
|
+
.bundle/*
|
10
|
+
.yardoc/*
|
11
|
+
yardoc/*
|
12
|
+
tmp/*
|
13
|
+
man/*
|
14
|
+
*.tmproj
|
15
|
+
rdoc/*
|
16
|
+
*.orig
|
17
|
+
*.BACKUP.*
|
18
|
+
*.BASE.*
|
19
|
+
*.LOCAL.*
|
20
|
+
*.REMOTE.*
|
21
|
+
git_pull.txt
|
22
|
+
coverage
|
23
|
+
critic
|
24
|
+
.DS_Store
|
25
|
+
TAGS
|
26
|
+
tmtags
|
27
|
+
*.sw?
|
28
|
+
.idea
|
29
|
+
.rbx/*
|
30
|
+
lib/**/*.bundle
|
31
|
+
lib/**/*.so
|
32
|
+
lib/**/*.jar
|
33
|
+
ext/**/*.bundle
|
34
|
+
ext/**/*.so
|
35
|
+
ext/**/*.jar
|
7
36
|
pkg
|
8
37
|
*.gem
|
data/.travis.yml
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
4
|
+
- 2.2.0
|
5
|
+
- 2.1.5
|
6
|
+
- 2.1.4
|
3
7
|
- 2.0.0
|
4
8
|
- 1.9.3
|
5
|
-
-
|
6
|
-
- jruby-
|
7
|
-
- jruby-
|
9
|
+
- ruby-head
|
10
|
+
- jruby-1.7.18
|
11
|
+
- jruby-head
|
8
12
|
- rbx-2
|
13
|
+
|
9
14
|
jdk:
|
10
15
|
- oraclejdk8
|
16
|
+
|
17
|
+
sudo: false
|
18
|
+
|
19
|
+
branches:
|
20
|
+
only:
|
21
|
+
- master
|
22
|
+
|
23
|
+
matrix:
|
24
|
+
allow_failures:
|
25
|
+
- rvm: ruby-head
|
26
|
+
- rvm: jruby-head
|
27
|
+
- rvm: 1.9.3
|
data/Gemfile
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'rake', '~> 10.3.2'
|
7
|
+
gem 'rake-compiler', '~> 0.9.2'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :testing do
|
11
|
+
gem 'minitest', '>= 5.0.0', :group => :development
|
12
|
+
end
|
data/README.md
CHANGED
@@ -1,10 +1,35 @@
|
|
1
|
-
|
2
|
-
========================================================================
|
1
|
+
# Ruby Atomic
|
3
2
|
|
4
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/atomic.svg)](http://badge.fury.io/rb/atomic) [![Build Status](https://travis-ci.org/ruby-concurrency/atomic.svg?branch=master)](https://travis-ci.org/ruby-concurrency/atomic) [![Code Climate](https://codeclimate.com/github/ruby-concurrency/atomic.svg)](https://codeclimate.com/github/ruby-concurrency/atomic) [![Dependency Status](https://gemnasium.com/ruby-concurrency/atomic.svg)](https://gemnasium.com/ruby-concurrency/atomic) [![License](https://img.shields.io/badge/license-Apache-green.svg)](http://opensource.org/licenses/Apache-2.0) [![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
An atomic reference implementation for JRuby, Rubinius, and MRI.
|
6
|
+
|
7
|
+
# Deprecated!
|
8
|
+
|
9
|
+
*This gem has been deprecated in lieu of [Concurrent Ruby](http://www.concurrent-ruby.com).
|
10
|
+
This gem will be retained in GitHUb and Rubygems.org indefinitely but no new development
|
11
|
+
will occur, including updates to support new versions of Ruby, JRuby, and Java. All users
|
12
|
+
of this gem are encouraged to update their projects to use `concurrent-ruby` instead.*
|
13
|
+
|
14
|
+
All code from this gem has been merged into `concurrent-ruby` and its companion gems.
|
15
|
+
All abstrations in this library are available in `concurrent-ruby` but have been moved
|
16
|
+
under the `Concurrent` module to avoid namespace collisions.
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# old way
|
20
|
+
require 'atomic'
|
21
|
+
my_atomic = Atomic.new(0)
|
22
|
+
|
23
|
+
# new way
|
24
|
+
require 'concurrent'
|
25
|
+
my_atomic = Concurrent::Atomic.new(0)
|
26
|
+
```
|
27
|
+
|
28
|
+
# Old Documentation
|
29
|
+
|
30
|
+
*For historic purposes only...*
|
31
|
+
|
32
|
+
## Summary
|
8
33
|
|
9
34
|
This library provides:
|
10
35
|
|
@@ -15,10 +40,9 @@ The Atomic class provides accessors for the contained "value" plus two update me
|
|
15
40
|
* update will run the provided block, passing the current value and replacing it with the block result if the value has not been changed in the meantime. It may run the block repeatedly if there are other concurrent updates in progress.
|
16
41
|
* try_update will run the provided block, passing the current value and replacing it with the block result. If the value changes before the update can happen, it will throw an Atomic::ConcurrentUpdateError.
|
17
42
|
|
18
|
-
The atomic repository is at http://github.com/
|
43
|
+
The atomic repository is at http://github.com/ruby-concurrency/ruby-atomic.
|
19
44
|
|
20
|
-
Usage
|
21
|
-
=====
|
45
|
+
## Usage
|
22
46
|
|
23
47
|
The simplest way to use "atomic" is to call the "update" or "try_update" methods.
|
24
48
|
|
@@ -47,7 +71,6 @@ my_atomic.compare_and_swap(2, 3) # => true, updated to 3
|
|
47
71
|
my_atomic.compare_and_swap(2, 3) # => false, current is not 2
|
48
72
|
```
|
49
73
|
|
50
|
-
Building
|
51
|
-
========
|
74
|
+
## Building
|
52
75
|
|
53
76
|
As of 1.1.0, JDK8 is required to build the atomic gem, since it attempts to use the new atomic Unsafe.getAndSetObject method only in JDK8. The resulting code should still work fine as far back as Java 5.
|
data/Rakefile
CHANGED
@@ -13,8 +13,6 @@
|
|
13
13
|
require 'rake'
|
14
14
|
require 'rake/testtask'
|
15
15
|
|
16
|
-
task :default => :test
|
17
|
-
|
18
16
|
desc "Run tests"
|
19
17
|
Rake::TestTask.new :test do |t|
|
20
18
|
t.libs << "lib"
|
@@ -61,3 +59,5 @@ end
|
|
61
59
|
|
62
60
|
task :package => :compile
|
63
61
|
task :test => :compile
|
62
|
+
|
63
|
+
task :default => :test
|
data/atomic.gemspec
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{atomic}
|
7
|
-
s.version = "1.1.
|
7
|
+
s.version = "1.1.99"
|
8
8
|
s.authors = ["Charles Oliver Nutter", "MenTaLguY", "Sokolov Yura"]
|
9
9
|
s.date = Time.now.strftime('%Y-%m-%d')
|
10
10
|
s.summary = "An atomic reference implementation for JRuby, Rubinius, and MRI"
|
11
11
|
s.description = s.summary
|
12
12
|
s.email = ["headius@headius.com", "mental@rydia.net", "funny.falcon@gmail.com"]
|
13
|
-
s.homepage = "http://github.com/
|
13
|
+
s.homepage = "http://github.com/ruby-concurrency/ruby-atomic"
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.licenses = ["Apache-2.0"]
|
16
16
|
s.test_files = Dir["test/test*.rb"]
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.extensions = 'ext/extconf.rb'
|
22
22
|
end
|
23
23
|
s.files += `git ls-files`.lines.map(&:chomp)
|
24
|
+
s.post_install_message = 'This gem has been deprecated and merged into Concurrent Ruby (http://concurrent-ruby.com).'
|
24
25
|
end
|
data/ext/atomic_reference.c
CHANGED
@@ -37,18 +37,31 @@ static VALUE ir_initialize(int argc, VALUE* argv, VALUE self) {
|
|
37
37
|
}
|
38
38
|
|
39
39
|
static VALUE ir_get(VALUE self) {
|
40
|
+
#if HAVE_GCC_SYNC
|
41
|
+
__sync_synchronize();
|
42
|
+
#elif defined _MSC_VER
|
43
|
+
MemoryBarrier();
|
44
|
+
#elif __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
|
45
|
+
OSMemoryBarrier();
|
46
|
+
#endif
|
40
47
|
return (VALUE) DATA_PTR(self);
|
41
48
|
}
|
42
49
|
|
43
50
|
static VALUE ir_set(VALUE self, VALUE new_value) {
|
44
51
|
DATA_PTR(self) = (void *) new_value;
|
52
|
+
#if HAVE_GCC_SYNC
|
53
|
+
__sync_synchronize();
|
54
|
+
#elif defined _MSC_VER
|
55
|
+
MemoryBarrier();
|
56
|
+
#elif __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
|
57
|
+
OSMemoryBarrier();
|
58
|
+
#endif
|
45
59
|
return new_value;
|
46
60
|
}
|
47
61
|
|
48
62
|
static VALUE ir_get_and_set(VALUE self, VALUE new_value) {
|
49
|
-
VALUE old_value;
|
50
|
-
|
51
|
-
DATA_PTR(self) = (void *) new_value;
|
63
|
+
VALUE old_value = ir_get(self);
|
64
|
+
ir_set(self, new_value);
|
52
65
|
return old_value;
|
53
66
|
}
|
54
67
|
|
data/ext/extconf.rb
CHANGED
@@ -37,11 +37,10 @@ if compiler_is_gcc
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
try_run(<<CODE,$CFLAGS) && ($defs << '-
|
40
|
+
try_run(<<CODE,$CFLAGS) && ($defs << '-DHAVE_GCC_SYNC')
|
41
41
|
int main() {
|
42
|
-
|
43
|
-
|
44
|
-
return (i != 4);
|
42
|
+
__sync_synchronize();
|
43
|
+
return 0;
|
45
44
|
}
|
46
45
|
CODE
|
47
46
|
|
data/test/test_atomic.rb
CHANGED
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.99
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Charles Oliver Nutter
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: An atomic reference implementation for JRuby, Rubinius, and MRI
|
16
16
|
email:
|
@@ -21,8 +21,11 @@ executables: []
|
|
21
21
|
extensions: []
|
22
22
|
extra_rdoc_files: []
|
23
23
|
files:
|
24
|
-
-
|
25
|
-
-
|
24
|
+
- lib/atomic_reference.jar
|
25
|
+
- test/test_atomic.rb
|
26
|
+
- .coveralls.yml
|
27
|
+
- .gitignore
|
28
|
+
- .travis.yml
|
26
29
|
- Gemfile
|
27
30
|
- LICENSE
|
28
31
|
- README.md
|
@@ -45,29 +48,27 @@ files:
|
|
45
48
|
- lib/atomic/numeric_cas_wrapper.rb
|
46
49
|
- lib/atomic/rbx.rb
|
47
50
|
- lib/atomic/ruby.rb
|
48
|
-
|
49
|
-
- test/test_atomic.rb
|
50
|
-
homepage: http://github.com/headius/ruby-atomic
|
51
|
+
homepage: http://github.com/ruby-concurrency/ruby-atomic
|
51
52
|
licenses:
|
52
53
|
- Apache-2.0
|
53
54
|
metadata: {}
|
54
|
-
post_install_message:
|
55
|
+
post_install_message: This gem has been deprecated and merged into Concurrent Ruby (http://concurrent-ruby.com).
|
55
56
|
rdoc_options: []
|
56
57
|
require_paths:
|
57
58
|
- lib
|
58
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
60
|
requirements:
|
60
|
-
- -
|
61
|
+
- - '>='
|
61
62
|
- !ruby/object:Gem::Version
|
62
63
|
version: '0'
|
63
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
65
|
requirements:
|
65
|
-
- -
|
66
|
+
- - '>='
|
66
67
|
- !ruby/object:Gem::Version
|
67
68
|
version: '0'
|
68
69
|
requirements: []
|
69
70
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.1.9
|
71
72
|
signing_key:
|
72
73
|
specification_version: 4
|
73
74
|
summary: An atomic reference implementation for JRuby, Rubinius, and MRI
|