@@ -17,20 +17,20 @@ module Concurrent
1717 # Stateful, mutable objects must be managed carefully when used asynchronously.
1818 # But Ruby is an object-oriented language so designing with objects and classes
1919 # plays to Ruby's strengths and is often more natural to many Ruby programmers.
20- # The + Async+ module is a way to mix simple yet powerful asynchronous capabilities
20+ # The ` Async` module is a way to mix simple yet powerful asynchronous capabilities
2121 # into any plain old Ruby object or class. These capabilities provide a reasonable
2222 # level of thread safe guarantees when used correctly.
2323 #
2424 # When this module is mixed into a class or object it provides to new methods:
25- # + async+ and + await+ . These methods are thread safe with respect to the enclosing
25+ # ` async` and ` await` . These methods are thread safe with respect to the enclosing
2626 # object. The former method allows methods to be called asynchronously by posting
2727 # to the global thread pool. The latter allows a method to be called synchronously
2828 # on the current thread but does so safely with respect to any pending asynchronous
29- # method calls. Both methods return an + Obligation+ which can be inspected for
30- # the result of the method call. Calling a method with + async+ will return a
31- # + :pending+ + Obligation+ whereas + await+ will return a + :complete+ + Obligation+ .
29+ # method calls. Both methods return an ` Obligation` which can be inspected for
30+ # the result of the method call. Calling a method with ` async` will return a
31+ # ` :pending` ` Obligation` whereas ` await` will return a ` :complete` ` Obligation` .
3232 #
33- # Very loosely based on the + async+ and + await+ keywords in C#.
33+ # Very loosely based on the ` async` and ` await` keywords in C#.
3434 #
3535 # @example Defining an asynchronous class
3636 # class Echo
@@ -64,9 +64,9 @@ module Concurrent
6464 # @note Thread safe guarantees can only be made when asynchronous method calls
6565 # are not mixed with synchronous method calls. Use only synchronous calls
6666 # when the object is used exclusively on a single thread. Use only
67- # + async+ and + await+ when the object is shared between threads. Once you
68- # call a method using + async+ , you should no longer call any methods
69- # directly on the object. Use + async+ and + await+ exclusively from then on.
67+ # ` async` and ` await` when the object is shared between threads. Once you
68+ # call a method using ` async` , you should no longer call any methods
69+ # directly on the object. Use ` async` and ` await` exclusively from then on.
7070 # With careful programming it is possible to switch back and forth but it's
7171 # also very easy to create race conditions and break your application.
7272 # Basically, it's "async all the way down."
@@ -83,14 +83,14 @@ module Async
8383 # @param [Symbol] method the method to check the object for
8484 # @param [Array] args zero or more arguments for the arity check
8585 #
86- # @raise [NameError] the object does not respond to + method+ method
87- # @raise [ArgumentError] the given + args+ do not match the arity of + method+
86+ # @raise [NameError] the object does not respond to ` method` method
87+ # @raise [ArgumentError] the given ` args` do not match the arity of ` method`
8888 #
8989 # @note This check is imperfect because of the way Ruby reports the arity of
9090 # methods with a variable number of arguments. It is possible to determine
9191 # if too few arguments are given but impossible to determine if too many
9292 # arguments are given. This check may also fail to recognize dynamic behavior
93- # of the object, such as methods simulated with + method_missing+ .
93+ # of the object, such as methods simulated with ` method_missing` .
9494 #
9595 # @see http://www.ruby-doc.org/core-2.1.1/Method.html#method-i-arity Method#arity
9696 # @see http://ruby-doc.org/core-2.1.0/Object.html#method-i-respond_to-3F Object#respond_to?
@@ -112,8 +112,8 @@ def validate_argc(obj, method, *args)
112112 # @!visibility private
113113 class AwaitDelegator # :nodoc:
114114
115- # Create a new delegator object wrapping the given + delegate+ and
116- # protecting it with the given + mutex+ .
115+ # Create a new delegator object wrapping the given ` delegate` and
116+ # protecting it with the given ` mutex` .
117117 #
118118 # @param [Object] delegate the object to wrap and delegate method calls to
119119 # @param [Mutex] mutex the mutex lock to use when delegating method calls
@@ -124,15 +124,15 @@ def initialize(delegate, mutex)
124124
125125 # Delegates method calls to the wrapped object. For performance,
126126 # dynamically defines the given method on the delegator so that
127- # all future calls to + method+ will not be directed here.
127+ # all future calls to ` method` will not be directed here.
128128 #
129129 # @param [Symbol] method the method being called
130130 # @param [Array] args zero or more arguments to the method
131131 #
132132 # @return [IVar] the result of the method call
133133 #
134- # @raise [NameError] the object does not respond to + method+ method
135- # @raise [ArgumentError] the given + args+ do not match the arity of + method+
134+ # @raise [NameError] the object does not respond to ` method` method
135+ # @raise [ArgumentError] the given ` args` do not match the arity of ` method`
136136 def method_missing ( method , *args , &block )
137137 super unless @delegate . respond_to? ( method )
138138 Async ::validate_argc ( @delegate , method , *args )
@@ -166,8 +166,8 @@ def method_missing(method, *args, &block)
166166 # @!visibility private
167167 class AsyncDelegator # :nodoc:
168168
169- # Create a new delegator object wrapping the given + delegate+ and
170- # protecting it with the given + mutex+ .
169+ # Create a new delegator object wrapping the given ` delegate` and
170+ # protecting it with the given ` mutex` .
171171 #
172172 # @param [Object] delegate the object to wrap and delegate method calls to
173173 # @param [Mutex] mutex the mutex lock to use when delegating method calls
@@ -179,15 +179,15 @@ def initialize(delegate, executor, mutex)
179179
180180 # Delegates method calls to the wrapped object. For performance,
181181 # dynamically defines the given method on the delegator so that
182- # all future calls to + method+ will not be directed here.
182+ # all future calls to ` method` will not be directed here.
183183 #
184184 # @param [Symbol] method the method being called
185185 # @param [Array] args zero or more arguments to the method
186186 #
187187 # @return [IVar] the result of the method call
188188 #
189- # @raise [NameError] the object does not respond to + method+ method
190- # @raise [ArgumentError] the given + args+ do not match the arity of + method+
189+ # @raise [NameError] the object does not respond to ` method` method
190+ # @raise [ArgumentError] the given ` args` do not match the arity of ` method`
191191 def method_missing ( method , *args , &block )
192192 super unless @delegate . respond_to? ( method )
193193 Async ::validate_argc ( @delegate , method , *args )
@@ -214,29 +214,29 @@ def method_missing(method, *args, &block)
214214
215215 # Causes the chained method call to be performed asynchronously on the
216216 # global thread pool. The method called by this method will return a
217- # + Future+ object in the + :pending+ state and the method call will have
217+ # ` Future` object in the ` :pending` state and the method call will have
218218 # been scheduled on the global thread pool. The final disposition of the
219- # method call can be obtained by inspecting the returned + Future+ .
219+ # method call can be obtained by inspecting the returned ` Future` .
220220 #
221221 # Before scheduling the method on the global thread pool a best-effort
222222 # attempt will be made to validate that the method exists on the object
223223 # and that the given arguments match the arity of the requested function.
224224 # Due to the dynamic nature of Ruby and limitations of its reflection
225225 # library, some edge cases will be missed. For more information see
226- # the documentation for the + validate_argc+ method.
226+ # the documentation for the ` validate_argc` method.
227227 #
228228 # @note The method call is guaranteed to be thread safe with respect to
229229 # all other method calls against the same object that are called with
230- # either + async+ or + await+ . The mutable nature of Ruby references
230+ # either ` async` or ` await` . The mutable nature of Ruby references
231231 # (and object orientation in general) prevent any other thread safety
232232 # guarantees. Do NOT mix non-protected method calls with protected
233233 # method call. Use ONLY protected method calls when sharing the object
234234 # between threads.
235235 #
236236 # @return [Concurrent::Future] the pending result of the asynchronous operation
237237 #
238- # @raise [NameError] the object does not respond to + method+ method
239- # @raise [ArgumentError] the given + args+ do not match the arity of + method+
238+ # @raise [NameError] the object does not respond to ` method` method
239+ # @raise [ArgumentError] the given ` args` do not match the arity of ` method`
240240 #
241241 # @see Concurrent::Future
242242 def async
@@ -246,29 +246,29 @@ def async
246246
247247 # Causes the chained method call to be performed synchronously on the
248248 # current thread. The method called by this method will return an
249- # + IVar+ object in either the + :fulfilled+ or + rejected+ state and the
249+ # ` IVar` object in either the ` :fulfilled` or ` rejected` state and the
250250 # method call will have completed. The final disposition of the
251- # method call can be obtained by inspecting the returned + IVar+ .
251+ # method call can be obtained by inspecting the returned ` IVar` .
252252 #
253253 # Before scheduling the method on the global thread pool a best-effort
254254 # attempt will be made to validate that the method exists on the object
255255 # and that the given arguments match the arity of the requested function.
256256 # Due to the dynamic nature of Ruby and limitations of its reflection
257257 # library, some edge cases will be missed. For more information see
258- # the documentation for the + validate_argc+ method.
258+ # the documentation for the ` validate_argc` method.
259259 #
260260 # @note The method call is guaranteed to be thread safe with respect to
261261 # all other method calls against the same object that are called with
262- # either + async+ or + await+ . The mutable nature of Ruby references
262+ # either ` async` or ` await` . The mutable nature of Ruby references
263263 # (and object orientation in general) prevent any other thread safety
264264 # guarantees. Do NOT mix non-protected method calls with protected
265265 # method call. Use ONLY protected method calls when sharing the object
266266 # between threads.
267267 #
268268 # @return [Concurrent::IVar] the completed result of the synchronous operation
269269 #
270- # @raise [NameError] the object does not respond to + method+ method
271- # @raise [ArgumentError] the given + args+ do not match the arity of + method+
270+ # @raise [NameError] the object does not respond to ` method` method
271+ # @raise [ArgumentError] the given ` args` do not match the arity of ` method`
272272 #
273273 # @see Concurrent::IVar
274274 def await
0 commit comments