-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Builds two gems from one repo. Specs and docs need updated.
- Loading branch information
Showing
16 changed files
with
106 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Gem::Specification.new do |s| | ||
s.name = 'concurrent-ruby-ext' | ||
s.version = '0.1.0.pre1' | ||
s.platform = Gem::Platform::RUBY | ||
s.author = "Jerry D'Antonio" | ||
s.email = 'jerry.dantonio@gmail.com' | ||
s.homepage = 'http://www.concurrent-ruby.com' | ||
s.summary = 'C extensions to optimize concurrent-ruby under MRI.' | ||
s.license = 'MIT' | ||
s.date = Time.now.strftime('%Y-%m-%d') | ||
|
||
s.description = <<-EOF | ||
Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more. | ||
Inspired by Erlang, Clojure, Go, JavaScript, actors, and classic concurrency patterns. | ||
EOF | ||
|
||
s.files = Dir['ext/**/*.{h,c,cpp}'] | ||
s.files += [ | ||
'lib/concurrent/atomic_reference/concurrent_update_error.rb', | ||
'lib/concurrent/atomic_reference/direct_update.rb', | ||
'lib/concurrent/atomic_reference/numeric_cas_wrapper.rb', | ||
] | ||
s.extra_rdoc_files = Dir['README*', 'LICENSE*', 'CHANGELOG*'] | ||
s.require_paths = ['lib'] | ||
s.extensions = 'ext/concurrent_ruby_ext/extconf.rb' | ||
|
||
s.required_ruby_version = '>= 1.9.3' | ||
|
||
s.add_runtime_dependency 'concurrent-ruby', '~> 0.8.0.pre1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Concurrent | ||
VERSION = '0.7.1' | ||
VERSION = '0.8.0.pre1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
module Concurrent | ||
|
||
@@c_ext_loaded ||= false | ||
@@java_ext_loaded ||= false | ||
|
||
# @!visibility private | ||
def self.allow_c_extensions? | ||
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' | ||
end | ||
|
||
# @!visibility private | ||
def self.allow_c_native_class?(clazz) | ||
allow_c_extensions? && Concurrent.const_defined?(clazz) | ||
rescue | ||
false | ||
end | ||
|
||
# @!visibility private | ||
def self.safe_require_c_extensions | ||
require 'concurrent_ruby_ext' if allow_c_extensions? | ||
rescue LoadError | ||
#warn 'Attempted to load C extensions on unsupported platform. Continuing with pure-Ruby.' | ||
end | ||
|
||
# @!visibility private | ||
def self.safe_require_java_extensions | ||
require 'concurrent_ruby_ext' if RUBY_PLATFORM == 'java' | ||
rescue LoadError | ||
#warn 'Attempted to load Java extensions on unsupported platform. Continuing with pure-Ruby.' | ||
if allow_c_extensions? && !@@c_ext_loaded | ||
begin | ||
require 'concurrent_ruby_ext' | ||
@@c_ext_loaded = true | ||
rescue LoadError | ||
# may be a Windows cross-compiled native gem | ||
begin | ||
require "#{RUBY_VERSION[0..2]}/concurrent_ruby_ext" | ||
@@c_ext_loaded = true | ||
rescue LoadError | ||
warn 'Performance on MRI may be improved with the concurrent-ruby-ext gem. Please see http://concurrent-ruby.com' | ||
end | ||
end | ||
elsif RUBY_PLATFORM == 'java' && !@@java_ext_loaded | ||
begin | ||
require 'concurrent_ruby_ext' | ||
@@java_ext_loaded = true | ||
rescue LoadError | ||
#warn 'Attempted to load Java extensions on unsupported platform. Continuing with pure-Ruby.' | ||
end | ||
end | ||
end |