Skip to content

Commit e27a783

Browse files
committed
Fixed yardoc.
1 parent 1733926 commit e27a783

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

doc/channel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fibonacci(c, quit)
176176

177177
## Closing and Iterating Over Channels
178178

179-
Newly created channels are in an "open" state. Open channels can receive values via `put` operations. When a program is done with a channel it can be closed by calling the {#close} method. Once a channel is closed it will no longer allow values to be `put`. If the channel is buffered and values are in the buffer when the channel is closed, the remaining values can still be removed via `take` operations.
179+
Newly created channels are in an "open" state. Open channels can receive values via `put` operations. When a program is done with a channel it can be closed by calling the `#close` method. Once a channel is closed it will no longer allow values to be `put`. If the channel is buffered and values are in the buffer when the channel is closed, the remaining values can still be removed via `take` operations.
180180

181181
The `Channel` class implements an {#each} method which can be used to retrieve successive values from the channel. The `each` method is a blocking method. When the channel is open and there are no values in the buffer, `each` will block until a new item is `put`. The `each` method will not exit until the channel is closed.
182182

doc/synchronization.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Provides common parent for all objects which need to be synchronized or be using other synchronization tools. It provides:
88

99
- Synchronized block
10-
- Methods for waiting and signaling
10+
- Methods for waiting and signaling
1111
- Volatile fields
1212
- Ensure visibility of final fields
1313
- Fields with CAS operations
@@ -49,7 +49,7 @@ private
4949
def ns_compute
5050
ns_compute_reduce ns_compute_map
5151
end
52-
```
52+
```
5353
where `compute` defines how is it synchronized and `ns_compute` handles the behavior (in this case the computation). `ns_` methods should only call other `ns_` methods or `pr_` methods. They can call normal methods on other objects, but that should be done with care (better to avoid) because the thread escapes this object while the lock is still held, which can lead to deadlock. That's why the `report` method is called in `compute` and not in `ns_compute`.
5454

5555
`pr_` methods are pure functions they can be used in and outside of synchronized blocks.
@@ -60,16 +60,16 @@ Sometimes while already inside the synchronized block some condition is not met.
6060

6161
To fulfill these needs there are private methods:
6262

63-
- `ns_wait` {include:Concurrent::Synchronization::AbstractObject#ns_wait}
64-
- `ns_wait_until` {include:Concurrent::Synchronization::AbstractObject#ns_wait_until}
65-
- `ns_signal` {include:Concurrent::Synchronization::AbstractObject#ns_signal}
66-
- `ns_broadcast` {include:Concurrent::Synchronization::AbstractObject#ns_broadcast}
63+
- `ns_wait` {include:Concurrent::Synchronization::AbstractLockableObject#ns_wait}
64+
- `ns_wait_until` {include:Concurrent::Synchronization::AbstractLockableObject#ns_wait_until}
65+
- `ns_signal` {include:Concurrent::Synchronization::AbstractLockableObject#ns_signal}
66+
- `ns_broadcast` {include:Concurrent::Synchronization::AbstractLockableObject#ns_broadcast}
6767

6868
All methods have to be called inside synchronized block.
6969

7070
## Volatile fields
7171

72-
`Synchronization::Object` can have volatile fields (Java semantic). They are defined by `attr_volatile :field_name`. `attr_volatile` defines reader and writer with the `field_name`. Any write is always immediately visible for any subsequent reads of the same field.
72+
`Synchronization::Object` can have volatile fields (Java semantic). They are defined by `attr_volatile :field_name`. `attr_volatile` defines reader and writer with the `field_name`. Any write is always immediately visible for any subsequent reads of the same field.
7373

7474
## Ensure visibility of final fields
7575

@@ -83,7 +83,7 @@ class AbstractPromise < Synchronization::Object
8383
ensure_ivar_visibility!
8484
end
8585
# ...
86-
end
86+
end
8787
```
8888

8989
### Naming conventions
@@ -112,10 +112,10 @@ class Event < Synchronization::Object
112112
self
113113
end
114114
# ...
115-
end
115+
end
116116
```
117117

118-
Operations on `@Touched` field have volatile semantic.
118+
Operations on `@Touched` field have volatile semantic.
119119

120120
## Memory model
121121

@@ -125,7 +125,7 @@ When writing libraries in `concurrent-ruby` we are reasoning based on following
125125

126126
The memory model is constructed based on our best effort and knowledge of the 3 main Ruby implementations (CRuby, JRuby, Rubinius). When considering certain aspect we always choose the weakest guarantee (e.g. local variable updates are always visible in CRuby but not in JRuby, so in this case JRuby behavior is picked). If some Ruby behavior is omitted here it is considered unsafe for use in parallel environment (Reasons may be lack of information, or difficulty of verification).
127127

128-
This takes in account following implementations:
128+
This takes in account following implementations:
129129

130130
- CRuby 1.9 - 2.2 (no differences found)
131131
- JRuby 1.7
@@ -139,10 +139,10 @@ We are interested in following behaviors:
139139

140140
### Variables
141141

142-
- **Local variables** - atomic assignment (only Integer and Object), non-volatile.
142+
- **Local variables** - atomic assignment (only Integer and Object), non-volatile.
143143
- Consequence: a lambda defined on `thread1` executing on `thread2` may not see updated values in local variables captured in its closure.
144144
- Reason: local variables are non-volatile on Jruby and Rubinius.
145-
- **Instance variables** - atomic assignment (only Integer and Object), non-volatile.
145+
- **Instance variables** - atomic assignment (only Integer and Object), non-volatile.
146146
- Consequence: Different thread may see old values; different thread may see not fully-initialized object.
147147
- Reason: local variables are non-volatile on Jruby and Rubinius.
148148
- **Constants** - atomic assignment, volatile.

lib/concurrent/synchronization/object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Synchronization
2020
# @!macro [attach] synchronization_object
2121
#
2222
# Safe synchronization under any Ruby implementation.
23-
# It provides methods like {#synchronize}, {#wait}, {#signal} and {#broadcast}.
23+
# It provides methods like `#synchronize`, `#wait`, `#signal` and `#broadcast`.
2424
# Provides a single layer which can improve its implementation over time without changes needed to
2525
# the classes using it. Use {Synchronization::Object} not this abstract class.
2626
#

0 commit comments

Comments
 (0)