concurrent-ruby 1.0.0.pre3 → 1.0.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dc607165069d68d20f3cdc11dc2fda36987a341
4
- data.tar.gz: 7e6c28de16b282bb4339ab3e07a786f3c468c8b4
3
+ metadata.gz: 2c97013c9e44933fb0b71553938a6c582c540234
4
+ data.tar.gz: 7c5e9eaa3ff9649b50384c5a68ea39dbe1bacd80
5
5
  SHA512:
6
- metadata.gz: 5af93689cc08e9415e23aba1bda309226bbdff2a1b99f30ffd4e879f1e6190d86aba2b1be9b83b1681717e63f8e6d9c2fb53e4e542260f3e855ee12b6a74770e
7
- data.tar.gz: 84030bd44e276836f3f329bace8489181de2c87c7aa311acd460bf714958ffe755dd555ba8aea0d8ecd621098f07b9f3dde6774913100d10e1998e26aa0d9f6f
6
+ metadata.gz: 8e138f95c21c8fdc05e9c3c107e5d58029acebef7dbad68a0fe3b6f7e79dd0faee9db8d255deef0871e7bdadf7e9c641a21dd13b88f1528d96d424ddcef7399f
7
+ data.tar.gz: 8f860fef518fbd5ea8df55bd0e5da79eabeb3fe48e615cf98e48946c6dcdbd09010b84709678c41e26380c02905b4310fb875d73b8609ab474cd16c4ec27f160
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  ### Upcoming Release v1.0.0 (TBD)
2
2
 
3
- ## Current Release v1.0.0.pre3 (29 September 2015)
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 Concurrent.on_jruby?
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 Concurrent.on_jruby?
99
+ when defined?(JavaAtomicFixnum)
100
100
  JavaAtomicFixnum
101
101
  when defined?(CAtomicFixnum)
102
102
  CAtomicFixnum
@@ -91,7 +91,7 @@ module Concurrent
91
91
  # @!visibility private
92
92
  # @!macro internal_implementation_note
93
93
  SemaphoreImplementation = case
94
- when Concurrent.on_jruby?
94
+ when defined?(JavaSemaphore)
95
95
  JavaSemaphore
96
96
  else
97
97
  MutexSemaphore
@@ -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
- @completed_task_count += 1 if success
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
@@ -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 defined?(RUBY_ENGINE)
10
- case RUBY_ENGINE
11
- when 'jruby'
12
- # noinspection RubyResolve
13
- JRubyMapBackend
14
- when 'ruby'
15
- require 'concurrent/collection/map/mri_map_backend'
16
- MriMapBackend
17
- when 'rbx'
18
- require 'concurrent/collection/map/atomic_reference_map_backend'
19
- AtomicReferenceMapBackend
20
- else
21
- warn 'Concurrent::Map: unsupported Ruby engine, using a fully synchronized Concurrent::Map implementation' if $VERBOSE
22
- require 'concurrent/collection/map/synchronized_map_backend'
23
- SynchronizedMapBackend
24
- end
25
- else
26
- MriMapBackend
27
- end
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
@@ -1,7 +1,7 @@
1
1
  module Concurrent
2
2
  module Synchronization
3
3
 
4
- if Concurrent.on_jruby?
4
+ if Concurrent.on_jruby? && Concurrent.java_extensions_loaded?
5
5
 
6
6
  # @!visibility private
7
7
  # @!macro internal_implementation_note
@@ -1,7 +1,7 @@
1
1
  module Concurrent
2
2
  module Synchronization
3
3
 
4
- if Concurrent.on_jruby?
4
+ if Concurrent.on_jruby? && Concurrent.java_extensions_loaded?
5
5
 
6
6
  # @!visibility private
7
7
  # @!macro internal_implementation_note
@@ -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 Concurrent.on_jruby?
11
+ when defined? JRubyLockableObject
12
12
  JRubyLockableObject
13
13
  when Concurrent.on_rbx?
14
14
  RbxLockableObject
@@ -6,7 +6,7 @@ module Concurrent
6
6
  ObjectImplementation = case
7
7
  when Concurrent.on_cruby?
8
8
  MriObject
9
- when Concurrent.on_jruby?
9
+ when defined? JRubyObject
10
10
  JRubyObject
11
11
  when Concurrent.on_rbx?
12
12
  RbxObject
@@ -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
- if Concurrent.on_cruby? && !@c_ext_loaded
19
- tries = [
20
- lambda do
21
- require 'concurrent/extension'
22
- @c_ext_loaded = true
23
- end,
24
- lambda do
25
- # may be a Windows cross-compiled native gem
26
- require "concurrent/#{RUBY_VERSION[0..2]}/extension"
27
- @c_ext_loaded = true
28
- end]
29
-
30
- tries.each do |try|
31
- begin
32
- try.call
33
- break
34
- rescue LoadError
35
- next
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
- if Concurrent.on_jruby? && !@java_ext_loaded
41
- begin
42
- require 'concurrent_ruby_ext'
43
- @java_ext_loaded = true
44
- rescue LoadError
45
- # move on with pure-Ruby implementations
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
@@ -1,4 +1,4 @@
1
1
  module Concurrent
2
- VERSION = '1.0.0.pre3'
3
- EDGE_VERSION = '0.2.0.pre3'
2
+ VERSION = '1.0.0.pre4'
3
+ EDGE_VERSION = '0.2.0.pre4'
4
4
  end
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.pre3
4
+ version: 1.0.0.pre4
5
5
  platform: ruby
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-09-29 00:00:00.000000000 Z
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.