Skip to content

Commit 124ea7e

Browse files
committed
Format documentation text to use less than 100 columns
1 parent 6a5d9bc commit 124ea7e

25 files changed

+413
-317
lines changed

lib/concurrent/actor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def self.spawn!(*args, &block)
8181

8282
# @overload spawn_optionify(context_class, name, *args)
8383
# @param [AbstractContext] context_class to be spawned
84-
# @param [String, Symbol] name of the instance, it's used to generate the {Core#path} of the actor
84+
# @param [String, Symbol] name of the instance, it's used to generate the
85+
# {Core#path} of the actor
8586
# @param args for context_class instantiation
8687
# @overload spawn_optionify(opts)
8788
# see {Core#initialize} opts

lib/concurrent/actor/behaviour/buffer.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ module Concurrent
22
module Actor
33
module Behaviour
44

5-
# Any message reaching this behaviour is buffered. Only one message is is scheduled
6-
# at any given time. Others are kept in buffer until another one can be scheduled.
7-
# This effectively means that messages handled by behaviours before buffer have higher priority
8-
# and they can be processed before messages arriving into buffer. This allows for
9-
# the processing of internal actor messages like (`:link`, `:supervise`) first.
5+
# Any message reaching this behaviour is buffered. Only one message is is
6+
# scheduled at any given time. Others are kept in buffer until another one
7+
# can be scheduled. This effectively means that messages handled by
8+
# behaviours before buffer have higher priority and they can be processed
9+
# before messages arriving into buffer. This allows for the processing of
10+
# internal actor messages like (`:link`, `:supervise`) first.
1011
class Buffer < Abstract
1112
def initialize(core, subsequent)
1213
super core, subsequent

lib/concurrent/actor/context.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@ def on_envelope(envelope)
3939
@envelope = nil
4040
end
4141

42-
# if you want to pass the message to next behaviour, usually {Behaviour::ErrorsOnUnknownMessage}
42+
# if you want to pass the message to next behaviour, usually
43+
# {Behaviour::ErrorsOnUnknownMessage}
4344
def pass
4445
core.behaviour!(Behaviour::ExecutesContext).pass envelope
4546
end
4647

47-
# Defines an actor responsible for dead letters. Any rejected message send with
48-
# {Reference#tell} is sent there, a message with ivar is considered already monitored for
49-
# failures. Default behaviour is to use {AbstractContext#dead_letter_routing} of the parent,
50-
# so if no {AbstractContext#dead_letter_routing} method is overridden in parent-chain the message ends up in
51-
# `Actor.root.dead_letter_routing` agent which will log warning.
48+
# Defines an actor responsible for dead letters. Any rejected message send
49+
# with {Reference#tell} is sent there, a message with ivar is considered
50+
# already monitored for failures. Default behaviour is to use
51+
# {AbstractContext#dead_letter_routing} of the parent, so if no
52+
# {AbstractContext#dead_letter_routing} method is overridden in
53+
# parent-chain the message ends up in `Actor.root.dead_letter_routing`
54+
# agent which will log warning.
5255
# @return [Reference]
5356
def dead_letter_routing
5457
parent.dead_letter_routing

lib/concurrent/actor/core.rb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ module Actor
44
require 'set'
55

66
# Core of the actor
7-
# @note Whole class should be considered private. An user should use {Context}s and {Reference}s only.
8-
# @note devel: core should not block on anything, e.g. it cannot wait on children to terminate
9-
# that would eat up all threads in task pool and deadlock
7+
# @note Whole class should be considered private. An user should use
8+
# {Context}s and {Reference}s only.
9+
# @note devel: core should not block on anything, e.g. it cannot wait on
10+
# children to terminate that would eat up all threads in task pool and
11+
# deadlock
1012
class Core
1113
include TypeCheck
1214
include Concurrent::Logging
@@ -36,11 +38,14 @@ class Core
3638
# @option opts [Executor] executor, default is `Concurrent.configuration.global_task_pool`
3739
# @option opts [true, false] link, atomically link the actor to its parent
3840
# @option opts [true, false] supervise, atomically supervise the actor by its parent
39-
# @option opts [Array<Array(Behavior::Abstract, Array<Object>)>] behaviour_definition, array of pairs
40-
# where each pair is behaviour class and its args, see {Behaviour.basic_behaviour_definition}
41-
# @option opts [IVar, nil] initialized, if present it'll be set or failed after {Context} initialization
42-
# @option opts [Proc, nil] logger a proc accepting (level, progname, message = nil, &block) params,
43-
# can be used to hook actor instance to any logging system
41+
# @option opts [Array<Array(Behavior::Abstract, Array<Object>)>]
42+
# behaviour_definition, array of pairs where each pair is behaviour
43+
# class and its args, see {Behaviour.basic_behaviour_definition}
44+
# @option opts [IVar, nil] initialized, if present it'll be set or failed
45+
# after {Context} initialization
46+
# @option opts [Proc, nil] logger a proc accepting (level, progname,
47+
# message = nil, &block) params, can be used to hook actor instance to
48+
# any logging system
4449
# @param [Proc] block for class instantiation
4550
def initialize(opts = {}, &block)
4651
synchronize do

lib/concurrent/agent.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class Agent
3232
#
3333
# @option opts [String] :dup_on_deref (false) call `#dup` before returning the data
3434
# @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
35-
# @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
36-
# returning the value returned from the proc
35+
# @option opts [String] :copy_on_deref (nil) call the given `Proc` passing
36+
# the internal value and returning the value returned from the proc
3737
def initialize(initial, opts = {})
3838
@value = initial
3939
@rescuers = []
@@ -63,7 +63,7 @@ def initialize(initial, opts = {})
6363
# rescue(NoMethodError){|ex| puts "Bam!" }.
6464
# rescue(ArgumentError){|ex| puts "Pow!" }.
6565
# rescue{|ex| puts "Boom!" }
66-
#
66+
#
6767
# score << proc{|current| raise ArgumentError }
6868
# sleep(0.1)
6969
# #=> puts "Pow!"

lib/concurrent/atomic/condition.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
module Concurrent
22

3-
# Condition is a better implementation of standard Ruby ConditionVariable.
4-
# The biggest difference is the wait return value: Condition#wait returns
5-
# Condition::Result which make possible to know if waiting thread has been woken up
6-
# by an another thread (using #signal or #broadcast) or due to timeout.
3+
# Condition is a better implementation of standard Ruby ConditionVariable. The
4+
# biggest difference is the wait return value: Condition#wait returns
5+
# Condition::Result which make possible to know if waiting thread has been
6+
# woken up by an another thread (using #signal or #broadcast) or due to
7+
# timeout.
78
#
8-
# Every #wait must be guarded by a locked Mutex or a ThreadError will be risen.
9-
# Although it's not mandatory, it's recommended to call also #signal and #broadcast within
10-
# the same mutex
9+
# Every #wait must be guarded by a locked Mutex or a ThreadError will be
10+
# risen. Although it's not mandatory, it's recommended to call also #signal
11+
# and #broadcast within the same mutex
1112
class Condition
1213

1314
class Result
@@ -17,12 +18,14 @@ def initialize(remaining_time)
1718

1819
attr_reader :remaining_time
1920

20-
# @return [Boolean] true if current thread has been waken up by a #signal or a #broadcast call, otherwise false
21+
# @return [Boolean] true if current thread has been waken up by a #signal
22+
# or a #broadcast call , otherwise false
2123
def woken_up?
2224
@remaining_time.nil? || @remaining_time > 0
2325
end
2426

25-
# @return [Boolean] true if current thread has been waken up due to a timeout, otherwise false
27+
# @return [Boolean] true if current thread has been waken up due to a
28+
# timeout, otherwise false
2629
def timed_out?
2730
@remaining_time != nil && @remaining_time <= 0
2831
end

lib/concurrent/atomic/copy_on_notify_observer_set.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ def initialize
1111
@observers = {}
1212
end
1313

14-
# Adds an observer to this set
15-
# If a block is passed, the observer will be created by this method and no other params should be passed
14+
# Adds an observer to this set. If a block is passed, the observer will be
15+
# created by this method and no other params should be passed
16+
#
1617
# @param [Object] observer the observer to add
17-
# @param [Symbol] func the function to call on the observer during notification. Default is :update
18+
# @param [Symbol] func the function to call on the observer during notification.
19+
# Default is :update
1820
# @return [Object] the added observer
1921
def add_observer(observer=nil, func=:update, &block)
2022
if observer.nil? && block.nil?

lib/concurrent/atomic/copy_on_write_observer_set.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ def initialize
1111
end
1212

1313
# Adds an observer to this set
14-
# If a block is passed, the observer will be created by this method and no other params should be passed
14+
# If a block is passed, the observer will be created by this method and no
15+
# other params should be passed
1516
# @param [Object] observer the observer to add
16-
# @param [Symbol] func the function to call on the observer during notification. Default is :update
17+
# @param [Symbol] func the function to call on the observer during notification.
18+
# Default is :update
1719
# @return [Object] the added observer
1820
def add_observer(observer=nil, func=:update, &block)
1921
if observer.nil? && block.nil?

lib/concurrent/atomic/cyclic_barrier.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class CyclicBarrier
88
# Create a new `CyclicBarrier` that waits for `parties` threads
99
#
1010
# @param [Fixnum] parties the number of parties
11-
# @yield an optional block that will be executed that will be executed after the last thread arrives and before the others are released
11+
# @yield an optional block that will be executed that will be executed after
12+
# the last thread arrives and before the others are released
1213
#
1314
# @raise [ArgumentError] if `parties` is not an integer or is less than zero
1415
def initialize(parties, &block)
@@ -31,10 +32,14 @@ def number_waiting
3132
@number_waiting
3233
end
3334

34-
# Blocks on the barrier until the number of waiting threads is equal to `parties` or until `timeout` is reached or `reset` is called
35-
# If a block has been passed to the constructor, it will be executed once by the last arrived thread before releasing the others
36-
# @param [Fixnum] timeout the number of seconds to wait for the counter or `nil` to block indefinitely
37-
# @return [Boolean] `true` if the `count` reaches zero else false on `timeout` or on `reset` or if the barrier is broken
35+
# Blocks on the barrier until the number of waiting threads is equal to
36+
# `parties` or until `timeout` is reached or `reset` is called
37+
# If a block has been passed to the constructor, it will be executed once by
38+
# the last arrived thread before releasing the others
39+
# @param [Fixnum] timeout the number of seconds to wait for the counter or
40+
# `nil` to block indefinitely
41+
# @return [Boolean] `true` if the `count` reaches zero else false on
42+
# `timeout` or on `reset` or if the barrier is broken
3843
def wait(timeout = nil)
3944
@mutex.synchronize do
4045

@@ -55,7 +60,8 @@ def wait(timeout = nil)
5560

5661

5762
# resets the barrier to its initial state
58-
# If there is at least one waiting thread, it will be woken up, the `wait` method will return false and the barrier will be broken
63+
# If there is at least one waiting thread, it will be woken up, the `wait`
64+
# method will return false and the barrier will be broken
5965
# If the barrier is broken, this method restores it to the original state
6066
#
6167
# @return [nil]
@@ -103,4 +109,4 @@ def wait_while_waiting(generation, timeout)
103109
end
104110

105111
end
106-
end
112+
end

lib/concurrent/atomic/semaphore.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ def try_acquire_timed(permits, timeout)
154154

155155
# @!macro semaphore
156156
#
157-
# A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each {#acquire} blocks if necessary
158-
# until a permit is available, and then takes it. Each {#release} adds a permit,
159-
# potentially releasing a blocking acquirer.
160-
# However, no actual permit objects are used; the Semaphore just keeps a count of the number available and
161-
# acts accordingly.
157+
# A counting semaphore. Conceptually, a semaphore maintains a set of
158+
# permits. Each {#acquire} blocks if necessary until a permit is
159+
# available, and then takes it. Each {#release} adds a permit, potentially
160+
# releasing a blocking acquirer.
161+
# However, no actual permit objects are used; the Semaphore just keeps a
162+
# count of the number available and acts accordingly.
162163
class Semaphore < JavaSemaphore
163164
end
164165

0 commit comments

Comments
 (0)