concurrent-ruby 1.0.0.pre3-java → 1.0.0.pre4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +8 -41
- data/lib/concurrent/atomic/atomic_boolean.rb +2 -2
- data/lib/concurrent/atomic/atomic_fixnum.rb +1 -1
- data/lib/concurrent/atomic/semaphore.rb +1 -1
- data/lib/concurrent/executor/ruby_thread_pool_executor.rb +17 -11
- data/lib/concurrent/map.rb +20 -19
- data/lib/concurrent/synchronization/jruby_lockable_object.rb +1 -1
- data/lib/concurrent/synchronization/jruby_object.rb +1 -1
- data/lib/concurrent/synchronization/lockable_object.rb +1 -1
- data/lib/concurrent/synchronization/object.rb +1 -1
- data/lib/concurrent/utility/native_extension_loader.rb +46 -29
- data/lib/concurrent/version.rb +2 -2
- data/lib/concurrent_ruby_ext.jar +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a7c20bd54b864a772fe6a21fc2b0cb34ba5a61
|
4
|
+
data.tar.gz: 5e1cddf585294a1152094a5062c110d788fd7577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0383528884a29a4765f663fa3189ba0498871d54d98ef7967e64d545051b8c32a7a697ddad633566664aec7efb7fd4234487c42ed3f71a525459cccda5378c49
|
7
|
+
data.tar.gz: aafa4b3db601bca8675e0078f99b9a962e7ccff12d032e1aaf27fcba483e81d1ae819fac20ddb3257bfd38de319a684925a82734e1d0a758c1970b1a4a2c972b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
### Upcoming Release v1.0.0 (TBD)
|
2
2
|
|
3
|
-
## Current Release v1.0.0.
|
3
|
+
## Current Release v1.0.0.pre4 (08 October 2015)
|
4
|
+
|
5
|
+
* Adopted a project Code of Conduct
|
6
|
+
* Cleared interpreter warnings
|
7
|
+
* Fixed bug in `ThreadPoolExecutor` task count methods
|
8
|
+
* Fixed bug in 'LockFreeLinkedSet'
|
9
|
+
* Improved Java extension loading
|
10
|
+
* Handle Exception children in Edge::Future
|
11
|
+
* Continued improvements to channel
|
12
|
+
|
13
|
+
### Release v1.0.0.pre3 (29 September 2015)
|
4
14
|
|
5
15
|
* Removed interpreter warnings.
|
6
16
|
* Shared constants now in `lib/concurrent/constants.rb`
|
data/README.md
CHANGED
@@ -49,6 +49,14 @@ MRI 1.9.3, 2.0, 2.1, 2.2, JRuby (1.9 mode), and Rubinius 2.x are supported.
|
|
49
49
|
This gem should be fully compatible with any interpreter that is compliant with Ruby 1.9.3 or newer.
|
50
50
|
Java 8 is preferred for JRuby but every Java version on which JRuby 9000 runs will be supported.
|
51
51
|
|
52
|
+
## Thread Safety
|
53
|
+
|
54
|
+
*Concurrent Ruby makes the strongest thread safety guarantees of any Ruby concurrency library. We are the only library with a published [memory model](https://github.com/ruby-concurrency/concurrent-ruby/blob/master/doc/synchronization.md) which provides consistent behavior and guarantees on all three of the main Ruby interpreters (MRI/CRuby, JRuby, and Rubinius).*
|
55
|
+
|
56
|
+
Every abstraction in this library is thread safe. Similarly, all are deadlock free and many are fully lock free. Specific thread safety guarantees are documented with each abstraction.
|
57
|
+
|
58
|
+
It is critical to remember, however, that Ruby is a language of mutable references. *No* concurrency library for Ruby can ever prevent the user from making thread safety mistakes (such as sharing a mutable object between threads and modifying it on both threads) or from creating deadlocks through incorrect use of locks. All the library can do is provide safe abstractions which encourage safe practices. Concurrent Ruby provides more safe concurrency abstractions than any other Ruby library, many of which support the mantra of ["Do not communicate by sharing memory; instead, share memory by communicating"](https://blog.golang.org/share-memory-by-communicating). Concurrent Ruby is also the only Ruby library which provides a full suite of thread safe and immutable variable types and data structures.
|
59
|
+
|
52
60
|
## Features & Documentation
|
53
61
|
|
54
62
|
We have a roadmap guiding our work toward the [v1.0.0 release](https://github.com/ruby-concurrency/concurrent-ruby/issues/257).
|
@@ -229,39 +237,6 @@ and load the appropriate C extensions.
|
|
229
237
|
No gems should depend on `concurrent-ruby-ext`. Doing so will force C extensions on your users.
|
230
238
|
The best practice is to depend on `concurrent-ruby` and let users to decide if they want C extensions.
|
231
239
|
|
232
|
-
### Building
|
233
|
-
|
234
|
-
All published versions of this gem (core, extension, and several platform-specific packages) are compiled,
|
235
|
-
packaged, tested, and published using an open, [automated process](https://github.com/ruby-concurrency/rake-compiler-dev-box).
|
236
|
-
This process can also be used to create pre-compiled binaries of the extension gem for virtually
|
237
|
-
any platform. *Documentation is forthcoming...*
|
238
|
-
|
239
|
-
```
|
240
|
-
*MRI only*
|
241
|
-
bundle exec rake build:native # Build concurrent-ruby-ext-<version>-<platform>.gem into the pkg dir
|
242
|
-
bundle exec rake compile:extension # Compile extension
|
243
|
-
|
244
|
-
*JRuby only*
|
245
|
-
bundle exec rake build # Build JRuby-specific core gem (alias for `build:core`)
|
246
|
-
bundle exec rake build:core # Build concurrent-ruby-<version>-java.gem into the pkg directory
|
247
|
-
|
248
|
-
*All except JRuby*
|
249
|
-
bundle exec rake build:core # Build concurrent-ruby-<version>.gem into the pkg directory
|
250
|
-
bundle exec rake build:ext # Build concurrent-ruby-ext-<version>.gem into the pkg directory
|
251
|
-
|
252
|
-
*When Docker IS installed*
|
253
|
-
bundle exec rake build:windows # Build the windows binary <version> gems per rake-compiler-dock
|
254
|
-
bundle exec rake build # Build core, extension, and edge gems, including Windows binaries
|
255
|
-
|
256
|
-
*When Docker is NOT installed*
|
257
|
-
bundle exec rake build # Build core, extension, and edge gems (excluding Windows binaries)
|
258
|
-
|
259
|
-
*All*
|
260
|
-
bundle exec rake clean # Remove any temporary products
|
261
|
-
bundle exec rake clobber # Remove any generated file
|
262
|
-
bundle exec rake compile # Compile all the extensions
|
263
|
-
```
|
264
|
-
|
265
240
|
## Maintainers
|
266
241
|
|
267
242
|
* [Jerry D'Antonio](https://github.com/jdantonio) (creator)
|
@@ -277,14 +252,6 @@ bundle exec rake compile # Compile all the extensions
|
|
277
252
|
* [Charles Oliver Nutter](https://github.com/headius) for the `atomic` and `thread_safe` gems
|
278
253
|
* [thedarkone](https://github.com/thedarkone) for the `thread_safe` gem
|
279
254
|
|
280
|
-
## Contributing
|
281
|
-
|
282
|
-
1. Fork it
|
283
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
284
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
285
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
286
|
-
5. Create new Pull Request
|
287
|
-
|
288
255
|
## License and Copyright
|
289
256
|
|
290
257
|
*Concurrent Ruby* is free software released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
@@ -48,7 +48,7 @@ module Concurrent
|
|
48
48
|
# Explicitly sets the value to false.
|
49
49
|
#
|
50
50
|
# @return [Boolean] true is value has changed, otherwise false
|
51
|
-
|
51
|
+
|
52
52
|
###################################################################
|
53
53
|
|
54
54
|
# @!macro [new] atomic_boolean_public_api
|
@@ -79,7 +79,7 @@ module Concurrent
|
|
79
79
|
# @!visibility private
|
80
80
|
# @!macro internal_implementation_note
|
81
81
|
AtomicBooleanImplementation = case
|
82
|
-
when
|
82
|
+
when defined?(JavaAtomicBoolean)
|
83
83
|
JavaAtomicBoolean
|
84
84
|
when defined?(CAtomicBoolean)
|
85
85
|
CAtomicBoolean
|
@@ -96,7 +96,7 @@ module Concurrent
|
|
96
96
|
# @!visibility private
|
97
97
|
# @!macro internal_implementation_note
|
98
98
|
AtomicFixnumImplementation = case
|
99
|
-
when
|
99
|
+
when defined?(JavaAtomicFixnum)
|
100
100
|
JavaAtomicFixnum
|
101
101
|
when defined?(CAtomicFixnum)
|
102
102
|
CAtomicFixnum
|
@@ -29,15 +29,6 @@ module Concurrent
|
|
29
29
|
# @!macro thread_pool_executor_attr_reader_min_length
|
30
30
|
attr_reader :min_length
|
31
31
|
|
32
|
-
# @!macro thread_pool_executor_attr_reader_largest_length
|
33
|
-
attr_reader :largest_length
|
34
|
-
|
35
|
-
# @!macro thread_pool_executor_attr_reader_scheduled_task_count
|
36
|
-
attr_reader :scheduled_task_count
|
37
|
-
|
38
|
-
# @!macro thread_pool_executor_attr_reader_completed_task_count
|
39
|
-
attr_reader :completed_task_count
|
40
|
-
|
41
32
|
# @!macro thread_pool_executor_attr_reader_idletime
|
42
33
|
attr_reader :idletime
|
43
34
|
|
@@ -49,6 +40,21 @@ module Concurrent
|
|
49
40
|
super(opts)
|
50
41
|
end
|
51
42
|
|
43
|
+
# @!macro thread_pool_executor_attr_reader_largest_length
|
44
|
+
def largest_length
|
45
|
+
synchronize { @largest_length }
|
46
|
+
end
|
47
|
+
|
48
|
+
# @!macro thread_pool_executor_attr_reader_scheduled_task_count
|
49
|
+
def scheduled_task_count
|
50
|
+
synchronize { @scheduled_task_count }
|
51
|
+
end
|
52
|
+
|
53
|
+
# @!macro thread_pool_executor_attr_reader_completed_task_count
|
54
|
+
def completed_task_count
|
55
|
+
synchronize { @completed_task_count }
|
56
|
+
end
|
57
|
+
|
52
58
|
# @!macro executor_service_method_can_overflow_question
|
53
59
|
def can_overflow?
|
54
60
|
synchronize { ns_limited_queue? }
|
@@ -174,6 +180,7 @@ module Concurrent
|
|
174
180
|
worker = (@ready.pop if @pool.size >= @min_length) || ns_add_busy_worker
|
175
181
|
if worker
|
176
182
|
worker << [task, args]
|
183
|
+
@completed_task_count += 1
|
177
184
|
true
|
178
185
|
else
|
179
186
|
false
|
@@ -219,8 +226,7 @@ module Concurrent
|
|
219
226
|
#
|
220
227
|
# @!visibility private
|
221
228
|
def ns_ready_worker(worker, success = true)
|
222
|
-
|
223
|
-
task_and_args = @queue.shift
|
229
|
+
task_and_args = @queue.shift
|
224
230
|
if task_and_args
|
225
231
|
worker << task_and_args
|
226
232
|
else
|
data/lib/concurrent/map.rb
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
require 'thread'
|
2
2
|
require 'concurrent/constants'
|
3
|
+
require 'concurrent/utility/native_extension_loader'
|
3
4
|
|
4
5
|
module Concurrent
|
5
6
|
# @!visibility private
|
6
7
|
module Collection
|
7
8
|
|
8
9
|
# @!visibility private
|
9
|
-
MapImplementation = if
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
MapImplementation = if Concurrent.java_extensions_loaded?
|
11
|
+
# noinspection RubyResolve
|
12
|
+
JRubyMapBackend
|
13
|
+
elsif defined?(RUBY_ENGINE)
|
14
|
+
case RUBY_ENGINE
|
15
|
+
when 'ruby'
|
16
|
+
require 'concurrent/collection/map/mri_map_backend'
|
17
|
+
MriMapBackend
|
18
|
+
when 'rbx'
|
19
|
+
require 'concurrent/collection/map/atomic_reference_map_backend'
|
20
|
+
AtomicReferenceMapBackend
|
21
|
+
else
|
22
|
+
warn 'Concurrent::Map: unsupported Ruby engine, using a fully synchronized Concurrent::Map implementation' if $VERBOSE
|
23
|
+
require 'concurrent/collection/map/synchronized_map_backend'
|
24
|
+
SynchronizedMapBackend
|
25
|
+
end
|
26
|
+
else
|
27
|
+
MriMapBackend
|
28
|
+
end
|
28
29
|
end
|
29
30
|
|
30
31
|
# `Concurrent::Map` is a hash-like object and should have much better performance
|
@@ -8,7 +8,7 @@ module Concurrent
|
|
8
8
|
MriMonitorLockableObject
|
9
9
|
when Concurrent.on_cruby? && Concurrent.ruby_version(:>, 1, 9, 3)
|
10
10
|
MriMutexLockableObject
|
11
|
-
when
|
11
|
+
when defined? JRubyLockableObject
|
12
12
|
JRubyLockableObject
|
13
13
|
when Concurrent.on_rbx?
|
14
14
|
RbxLockableObject
|
@@ -7,42 +7,57 @@ module Concurrent
|
|
7
7
|
# @!visibility private
|
8
8
|
module NativeExtensionLoader
|
9
9
|
|
10
|
-
@c_ext_loaded ||= false
|
11
|
-
@java_ext_loaded ||= false
|
12
|
-
|
13
|
-
# @!visibility private
|
14
10
|
def allow_c_extensions?
|
15
11
|
Concurrent.on_cruby?
|
16
12
|
end
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
14
|
+
def c_extensions_loaded?
|
15
|
+
@c_extensions_loaded ||= false
|
16
|
+
end
|
17
|
+
|
18
|
+
def java_extensions_loaded?
|
19
|
+
@java_extensions_loaded ||= false
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_c_extensions_loaded
|
23
|
+
@c_extensions_loaded = true
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_java_extensions_loaded
|
27
|
+
@java_extensions_loaded = true
|
28
|
+
end
|
29
|
+
|
30
|
+
def load_native_extensions
|
31
|
+
if Concurrent.on_cruby? && !c_extensions_loaded?
|
32
|
+
tries = [
|
33
|
+
lambda do
|
34
|
+
require 'concurrent/extension'
|
35
|
+
set_c_extensions_loaded
|
36
|
+
end,
|
37
|
+
lambda do
|
38
|
+
# may be a Windows cross-compiled native gem
|
39
|
+
require "concurrent/#{RUBY_VERSION[0..2]}/extension"
|
40
|
+
set_c_extensions_loaded
|
41
|
+
end]
|
42
|
+
|
43
|
+
tries.each do |try|
|
44
|
+
begin
|
45
|
+
try.call
|
46
|
+
break
|
47
|
+
rescue LoadError
|
48
|
+
next
|
49
|
+
end
|
36
50
|
end
|
37
51
|
end
|
38
|
-
end
|
39
52
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
53
|
+
if Concurrent.on_jruby? && !java_extensions_loaded?
|
54
|
+
begin
|
55
|
+
require 'concurrent_ruby_ext'
|
56
|
+
set_java_extensions_loaded
|
57
|
+
rescue LoadError
|
58
|
+
# move on with pure-Ruby implementations
|
59
|
+
warn 'On JRuby but Java extensions failed to load.'
|
60
|
+
end
|
46
61
|
end
|
47
62
|
end
|
48
63
|
end
|
@@ -51,3 +66,5 @@ module Concurrent
|
|
51
66
|
# @!visibility private
|
52
67
|
extend Utility::NativeExtensionLoader
|
53
68
|
end
|
69
|
+
|
70
|
+
Concurrent.load_native_extensions
|
data/lib/concurrent/version.rb
CHANGED
data/lib/concurrent_ruby_ext.jar
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concurrent-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Jerry D'Antonio
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |
|
15
15
|
Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
|