concurrent-ruby 1.1.10 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/Gemfile +0 -1
  4. data/README.md +21 -20
  5. data/Rakefile +53 -63
  6. data/ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java +10 -25
  7. data/lib/concurrent-ruby/concurrent/agent.rb +2 -1
  8. data/lib/concurrent-ruby/concurrent/array.rb +0 -10
  9. data/lib/concurrent-ruby/concurrent/atom.rb +1 -1
  10. data/lib/concurrent-ruby/concurrent/atomic/atomic_boolean.rb +5 -4
  11. data/lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb +5 -4
  12. data/lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb +3 -0
  13. data/lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb +81 -151
  14. data/lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb +1 -1
  15. data/lib/concurrent-ruby/concurrent/atomic/event.rb +1 -1
  16. data/lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb +109 -0
  17. data/lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb +1 -0
  18. data/lib/concurrent-ruby/concurrent/atomic/locals.rb +189 -0
  19. data/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb +28 -0
  20. data/lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb +11 -5
  21. data/lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb +11 -5
  22. data/lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb +1 -1
  23. data/lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb +1 -1
  24. data/lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb +2 -1
  25. data/lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb +5 -3
  26. data/lib/concurrent-ruby/concurrent/atomic/semaphore.rb +6 -9
  27. data/lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb +96 -89
  28. data/lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb +37 -0
  29. data/lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb +15 -4
  30. data/lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb +1 -1
  31. data/lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb +1 -1
  32. data/lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb +2 -0
  33. data/lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb +2 -2
  34. data/lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb +16 -8
  35. data/lib/concurrent-ruby/concurrent/concern/logging.rb +86 -2
  36. data/lib/concurrent-ruby/concurrent/concurrent_ruby.jar +0 -0
  37. data/lib/concurrent-ruby/concurrent/configuration.rb +4 -87
  38. data/lib/concurrent-ruby/concurrent/delay.rb +2 -2
  39. data/lib/concurrent-ruby/concurrent/errors.rb +5 -0
  40. data/lib/concurrent-ruby/concurrent/exchanger.rb +1 -0
  41. data/lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb +1 -1
  42. data/lib/concurrent-ruby/concurrent/executor/java_executor_service.rb +2 -2
  43. data/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb +1 -1
  44. data/lib/concurrent-ruby/concurrent/executor/serialized_execution.rb +1 -1
  45. data/lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb +4 -1
  46. data/lib/concurrent-ruby/concurrent/hash.rb +0 -9
  47. data/lib/concurrent-ruby/concurrent/immutable_struct.rb +1 -1
  48. data/lib/concurrent-ruby/concurrent/ivar.rb +2 -1
  49. data/lib/concurrent-ruby/concurrent/map.rb +43 -39
  50. data/lib/concurrent-ruby/concurrent/maybe.rb +1 -1
  51. data/lib/concurrent-ruby/concurrent/mutable_struct.rb +1 -1
  52. data/lib/concurrent-ruby/concurrent/mvar.rb +1 -1
  53. data/lib/concurrent-ruby/concurrent/promise.rb +1 -1
  54. data/lib/concurrent-ruby/concurrent/promises.rb +7 -6
  55. data/lib/concurrent-ruby/concurrent/re_include.rb +2 -0
  56. data/lib/concurrent-ruby/concurrent/scheduled_task.rb +1 -1
  57. data/lib/concurrent-ruby/concurrent/set.rb +0 -10
  58. data/lib/concurrent-ruby/concurrent/settable_struct.rb +2 -2
  59. data/lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb +5 -1
  60. data/lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb +1 -3
  61. data/lib/concurrent-ruby/concurrent/synchronization/condition.rb +2 -0
  62. data/lib/concurrent-ruby/concurrent/synchronization/full_memory_barrier.rb +29 -0
  63. data/lib/concurrent-ruby/concurrent/synchronization/jruby_lockable_object.rb +3 -1
  64. data/lib/concurrent-ruby/concurrent/synchronization/lock.rb +2 -0
  65. data/lib/concurrent-ruby/concurrent/synchronization/lockable_object.rb +5 -2
  66. data/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb +6 -5
  67. data/lib/concurrent-ruby/concurrent/synchronization/object.rb +12 -44
  68. data/lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb +36 -0
  69. data/lib/concurrent-ruby/concurrent/synchronization/volatile.rb +77 -12
  70. data/lib/concurrent-ruby/concurrent/synchronization.rb +1 -18
  71. data/lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb +36 -39
  72. data/lib/concurrent-ruby/concurrent/thread_safe/util/cheap_lockable.rb +2 -39
  73. data/lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb +1 -37
  74. data/lib/concurrent-ruby/concurrent/tuple.rb +1 -5
  75. data/lib/concurrent-ruby/concurrent/tvar.rb +2 -1
  76. data/lib/concurrent-ruby/concurrent/utility/engine.rb +5 -16
  77. data/lib/concurrent-ruby/concurrent/utility/monotonic_time.rb +3 -74
  78. data/lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb +8 -10
  79. data/lib/concurrent-ruby/concurrent/utility/native_integer.rb +1 -0
  80. data/lib/concurrent-ruby/concurrent/utility/processor_counter.rb +34 -54
  81. data/lib/concurrent-ruby/concurrent/version.rb +1 -1
  82. metadata +13 -15
  83. data/lib/concurrent-ruby/concurrent/atomic/abstract_thread_local_var.rb +0 -66
  84. data/lib/concurrent-ruby/concurrent/atomic/java_thread_local_var.rb +0 -37
  85. data/lib/concurrent-ruby/concurrent/atomic/ruby_thread_local_var.rb +0 -181
  86. data/lib/concurrent-ruby/concurrent/synchronization/jruby_object.rb +0 -45
  87. data/lib/concurrent-ruby/concurrent/synchronization/mri_object.rb +0 -44
  88. data/lib/concurrent-ruby/concurrent/synchronization/rbx_lockable_object.rb +0 -71
  89. data/lib/concurrent-ruby/concurrent/synchronization/rbx_object.rb +0 -49
  90. data/lib/concurrent-ruby/concurrent/synchronization/truffleruby_object.rb +0 -47
@@ -1,49 +0,0 @@
1
- module Concurrent
2
- module Synchronization
3
-
4
- # @!visibility private
5
- module RbxAttrVolatile
6
- def self.included(base)
7
- base.extend(ClassMethods)
8
- end
9
-
10
- module ClassMethods
11
-
12
- def attr_volatile(*names)
13
- names.each do |name|
14
- ivar = :"@volatile_#{name}"
15
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
16
- def #{name}
17
- Rubinius.memory_barrier
18
- #{ivar}
19
- end
20
-
21
- def #{name}=(value)
22
- #{ivar} = value
23
- Rubinius.memory_barrier
24
- end
25
- RUBY
26
- end
27
- names.map { |n| [n, :"#{n}="] }.flatten
28
- end
29
-
30
- end
31
-
32
- def full_memory_barrier
33
- # Rubinius instance variables are not volatile so we need to insert barrier
34
- # TODO (pitr 26-Nov-2015): check comments like ^
35
- Rubinius.memory_barrier
36
- end
37
- end
38
-
39
- # @!visibility private
40
- # @!macro internal_implementation_note
41
- class RbxObject < AbstractObject
42
- include RbxAttrVolatile
43
-
44
- def initialize
45
- # nothing to do
46
- end
47
- end
48
- end
49
- end
@@ -1,47 +0,0 @@
1
- module Concurrent
2
- module Synchronization
3
-
4
- # @!visibility private
5
- module TruffleRubyAttrVolatile
6
- def self.included(base)
7
- base.extend(ClassMethods)
8
- end
9
-
10
- module ClassMethods
11
- def attr_volatile(*names)
12
- names.each do |name|
13
- ivar = :"@volatile_#{name}"
14
-
15
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
16
- def #{name}
17
- full_memory_barrier
18
- #{ivar}
19
- end
20
-
21
- def #{name}=(value)
22
- #{ivar} = value
23
- full_memory_barrier
24
- end
25
- RUBY
26
- end
27
-
28
- names.map { |n| [n, :"#{n}="] }.flatten
29
- end
30
- end
31
-
32
- def full_memory_barrier
33
- TruffleRuby.full_memory_barrier
34
- end
35
- end
36
-
37
- # @!visibility private
38
- # @!macro internal_implementation_note
39
- class TruffleRubyObject < AbstractObject
40
- include TruffleRubyAttrVolatile
41
-
42
- def initialize
43
- # nothing to do
44
- end
45
- end
46
- end
47
- end