Skip to content

Commit 4a64e82

Browse files
committed
Merge pull request #322 from ruby-concurrency/api-private
Marked private API abstractions.
2 parents 37a3c30 + aafa28e commit 4a64e82

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+779
-396
lines changed

lib/concurrent.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
require 'concurrent/timer_task'
2727
require 'concurrent/tvar'
2828

29+
# @!macro [new] internal_implementation_note
30+
#
31+
# @note **Private Implementation:** This abstraction is a private, internal
32+
# implementation detail. It should never be used directly.
33+
2934
# @!macro [new] monotonic_clock_warning
3035
#
3136
# @note Time calculations one all platforms and languages are sensitive to

lib/concurrent/actor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module Concurrent
1111
# TODO more effective executor
1212

1313
# {include:file:doc/actor/main.md}
14+
# @api Actor
15+
# @!macro edge_warning
1416
module Actor
1517

1618
require 'concurrent/actor/type_check'

lib/concurrent/agent.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ module Concurrent
7979
#
8080
# @!attribute [r] timeout
8181
# @return [Fixnum] the maximum number of seconds before an update is cancelled
82+
#
83+
# @!macro edge_warning
8284
class Agent
8385
include Concern::Dereferenceable
8486
include Concern::Observable
@@ -91,7 +93,15 @@ class Agent
9193
#
9294
# @param [Object] initial the initial value
9395
#
94-
# @!macro executor_and_deref_options
96+
# @!macro [attach] executor_and_deref_options
97+
#
98+
# @param [Hash] opts the options used to define the behavior at update and deref
99+
# and to specify the executor on which to perform actions
100+
# @option opts [Executor] :executor when set use the given `Executor` instance.
101+
# Three special values are also supported: `:task` returns the global task pool,
102+
# `:operation` returns the global operation pool, and `:immediate` returns a new
103+
# `ImmediateExecutor` object.
104+
# @!macro deref_options
95105
def initialize(initial, opts = {})
96106
@value = initial
97107
@rescuers = []

lib/concurrent/atomic/atomic_boolean.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ module Concurrent
2222
# 3.340000 0.010000 3.350000 ( 0.855000)
2323
#
2424
# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicBoolean.html java.util.concurrent.atomic.AtomicBoolean
25+
#
26+
# @!visibility private
27+
#
28+
# @!macro internal_implementation_note
2529
class MutexAtomicBoolean < Synchronization::Object
2630

2731
# @!macro [attach] atomic_boolean_method_initialize
@@ -105,6 +109,8 @@ def ns_make_value(value)
105109
end
106110
end
107111

112+
# @!visibility private
113+
# @!macro internal_implementation_note
108114
AtomicBooleanImplementation = case
109115
when Concurrent.on_jruby?
110116
JavaAtomicBoolean

lib/concurrent/atomic/atomic_fixnum.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ module Concurrent
2222
# 4.520000 0.030000 4.550000 ( 1.187000)
2323
#
2424
# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html java.util.concurrent.atomic.AtomicLong
25+
#
26+
# @!visibility private
27+
# @!macro internal_implementation_note
2528
class MutexAtomicFixnum < Synchronization::Object
2629

2730
# http://stackoverflow.com/questions/535721/ruby-max-integer
@@ -132,6 +135,8 @@ def range_check!(value)
132135
end
133136
end
134137

138+
# @!visibility private
139+
# @!macro internal_implementation_note
135140
AtomicFixnumImplementation = case
136141
when Concurrent.on_jruby?
137142
JavaAtomicFixnum

lib/concurrent/atomic/count_down_latch.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ module Concurrent
1111
# method. Each of the other threads calls `#count_down` when done with its work.
1212
# When the latch counter reaches zero the waiting thread is unblocked and continues
1313
# with its work. A `CountDownLatch` can be used only once. Its value cannot be reset.
14+
#
15+
# @!visibility private
16+
# @!macro internal_implementation_note
1417
class PureCountDownLatch < Synchronization::Object
1518

1619
# @!macro [attach] count_down_latch_method_initialize
@@ -69,6 +72,8 @@ def ns_initialize(count)
6972
if Concurrent.on_jruby?
7073

7174
# @!macro count_down_latch
75+
# @!visibility private
76+
# @!macro internal_implementation_note
7277
class JavaCountDownLatch
7378

7479
# @!macro count_down_latch_method_initialize

lib/concurrent/atomic/cyclic_barrier.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module Concurrent
44

55
class CyclicBarrier < Synchronization::Object
66

7+
# @!visibility private
78
Generation = Struct.new(:status)
89
private_constant :Generation
910

lib/concurrent/atomic/semaphore.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ module Concurrent
1010
# releasing a blocking acquirer.
1111
# However, no actual permit objects are used; the Semaphore just keeps a
1212
# count of the number available and acts accordingly.
13+
#
14+
# @!visibility private
15+
#
16+
# @!macro internal_implementation_note
1317
class MutexSemaphore < Synchronization::Object
1418

1519
# @!macro [attach] semaphore_method_initialize
@@ -163,6 +167,8 @@ def try_acquire_timed(permits, timeout)
163167
end
164168
end
165169

170+
# @!visibility private
171+
# @!macro internal_implementation_note
166172
SemaphoreImplementation = case
167173
when Concurrent.on_jruby?
168174
JavaSemaphore

lib/concurrent/atomic/thread_local_var.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ module Concurrent
3232
# v.value #=> 14
3333
#
3434
# @see https://docs.oracle.com/javase/7/docs/api/java/lang/ThreadLocal.html Java ThreadLocal
35+
#
36+
# @!visibility private
3537
class AbstractThreadLocalVar
3638

39+
# @!visibility private
3740
NIL_SENTINEL = Object.new
3841
private_constant :NIL_SENTINEL
3942

@@ -112,6 +115,8 @@ def set(value)
112115
end
113116
end
114117

118+
# @!visibility private
119+
# @!macro internal_implementation_note
115120
class RubyThreadLocalVar < AbstractThreadLocalVar
116121

117122
protected
@@ -144,6 +149,8 @@ def set(value)
144149

145150
if Concurrent.on_jruby?
146151

152+
# @!visibility private
153+
# @!macro internal_implementation_note
147154
class JavaThreadLocalVar < AbstractThreadLocalVar
148155

149156
protected
@@ -165,6 +172,8 @@ def set(value)
165172
end
166173
end
167174

175+
# @!visibility private
176+
# @!macro internal_implementation_note
168177
ThreadLocalVarImplementation = case
169178
when Concurrent.on_jruby?
170179
JavaThreadLocalVar
@@ -174,9 +183,6 @@ def set(value)
174183
private_constant :ThreadLocalVarImplementation
175184

176185
# @!macro thread_local_var
177-
#
178-
# @see Concurrent::AbstractThreadLocalVar
179-
# @see Concurrent::RubyThreadLocalVar
180186
class ThreadLocalVar < ThreadLocalVarImplementation
181187

182188
# @!method initialize(default = nil)

lib/concurrent/atomic/thread_local_var/weak_key_map.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
module Concurrent
2323

24+
# @!visibility private
2425
class AbstractThreadLocalVar
2526

2627
begin

0 commit comments

Comments
 (0)