Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: YHujQy7tqpw5P0TuWjwk6Vd5Vuw8LcGvo
41 changes: 35 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
.*.sw?
lib/atomic_reference.jar
/nbproject
ext/*.bundle
ext/*.so
ext/*.jar
Gemfile.lock
*.gem
lib/1.8
lib/1.9
lib/2.0
.rvmrc
.ruby-version
.ruby-gemset
.bundle/*
.yardoc/*
yardoc/*
tmp/*
man/*
*.tmproj
rdoc/*
*.orig
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
git_pull.txt
coverage
critic
.DS_Store
TAGS
tmtags
*.sw?
.idea
.rbx/*
lib/**/*.bundle
lib/**/*.so
lib/**/*.jar
ext/**/*.bundle
ext/**/*.so
ext/**/*.jar
pkg
*.gem
23 changes: 20 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
language: ruby

rvm:
- 2.2.0
- 2.1.5
- 2.1.4
- 2.0.0
- 1.9.3
- 1.8.7
- jruby-18mode # JRuby in 1.8 mode
- jruby-19mode # JRuby in 1.9 mode
- ruby-head
- jruby-1.7.18
- jruby-head
- rbx-2

jdk:
- oraclejdk8

sudo: false

branches:
only:
- master

matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: 1.9.3
14 changes: 11 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
source "https://rubygems.org"
source 'https://rubygems.org'

gem 'rake-compiler'
gem 'minitest', '>= 5.0.0', :group => :development
gemspec

group :development do
gem 'rake', '~> 10.3.2'
gem 'rake-compiler', '~> 0.9.2'
end

group :testing do
gem 'minitest', '>= 5.0.0', :group => :development
end
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
atomic: An atomic reference implementation for JRuby, Rubinius, and MRI.
========================================================================
# Ruby Atomic

[![Build Status](https://travis-ci.org/headius/ruby-atomic.png?branch=master)](https://travis-ci.org/headius/ruby-atomic)
[![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)

Summary
=======
An atomic reference implementation for JRuby, Rubinius, and MRI.

# Deprecated!

*This gem has been deprecated in lieu of [Concurrent Ruby](http://www.concurrent-ruby.com).
This gem will be retained in GitHUb and Rubygems.org indefinitely but no new development
will occur, including updates to support new versions of Ruby, JRuby, and Java. All users
of this gem are encouraged to update their projects to use `concurrent-ruby` instead.*

All code from this gem has been merged into `concurrent-ruby` and its companion gems.
All abstrations in this library are available in `concurrent-ruby` but have been moved
under the `Concurrent` module to avoid namespace collisions.

```ruby
# old way
require 'atomic'
my_atomic = Atomic.new(0)

# new way
require 'concurrent'
my_atomic = Concurrent::Atomic.new(0)
```

# Old Documentation

*For historic purposes only...*

## Summary

This library provides:

Expand All @@ -15,10 +40,9 @@ The Atomic class provides accessors for the contained "value" plus two update me
* 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.
* 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.

The atomic repository is at http://github.com/headius/ruby-atomic.
The atomic repository is at http://github.com/ruby-concurrency/ruby-atomic.

Usage
=====
## Usage

The simplest way to use "atomic" is to call the "update" or "try_update" methods.

Expand Down Expand Up @@ -47,7 +71,6 @@ my_atomic.compare_and_swap(2, 3) # => true, updated to 3
my_atomic.compare_and_swap(2, 3) # => false, current is not 2
```

Building
========
## Building

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.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
require 'rake'
require 'rake/testtask'

task :default => :test

desc "Run tests"
Rake::TestTask.new :test do |t|
t.libs << "lib"
Expand Down Expand Up @@ -61,3 +59,5 @@ end

task :package => :compile
task :test => :compile

task :default => :test
5 changes: 3 additions & 2 deletions atomic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

Gem::Specification.new do |s|
s.name = %q{atomic}
s.version = "1.1.16"
s.version = "1.1.99"
s.authors = ["Charles Oliver Nutter", "MenTaLguY", "Sokolov Yura"]
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = "An atomic reference implementation for JRuby, Rubinius, and MRI"
s.description = s.summary
s.email = ["[email protected]", "[email protected]", "[email protected]"]
s.homepage = "http://github.com/headius/ruby-atomic"
s.homepage = "http://github.com/ruby-concurrency/ruby-atomic"
s.require_paths = ["lib"]
s.licenses = ["Apache-2.0"]
s.test_files = Dir["test/test*.rb"]
Expand All @@ -21,4 +21,5 @@ Gem::Specification.new do |s|
s.extensions = 'ext/extconf.rb'
end
s.files += `git ls-files`.lines.map(&:chomp)
s.post_install_message = 'This gem has been deprecated in lieu of Concurrent Ruby (http://concurrent-ruby.com).'
end