Skip to content

Commit 1d7546c

Browse files
committed
Minor edits.
1 parent 6e3172d commit 1d7546c

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ item is not dequeued until any items on which it depends have been dequeued.
2626
If one must ascribe a catchy initialism to such a queue, a nice one is WIRDO —
2727
**w**hatever **i**n, **r**everse **d**ependency **o**ut.
2828

29-
If an example would be helpful, skip to the Example section below.
29+
If an example would be helpful, skip to the [Example](#example) section below.
3030

3131
### Creation
3232

@@ -148,7 +148,9 @@ call `Complete()` to inform the queue.
148148
queue.Complete(entry);
149149
```
150150

151-
`TryDequeue()`, `TryDequeueAsync()`, and `Complete()` are thread-safe.
151+
`TryDequeue()`, `TryDequeueAsync()`, and `Complete()` are thread-safe. For
152+
full thread safety information, see the [Thread Safety](#thread-safety) section
153+
below.
152154

153155
Because dequeueing and completing entries is often done in a loop and in
154156
parallel, DependencyQueue provides `Run()` and `RunAsync()` methods that
@@ -200,8 +202,9 @@ await var entry = queue.TryDequeueAsync(
200202
### Inspection
201203

202204
To peek into a queue, the `DependencyQueue<T>` class provides the `Inspect()`
203-
method. The method acquires an exclusive lock on the queue and returns a
204-
read-only view of the queue that holds the lock until the view is disposed.
205+
and `InspectAsync()` methods. These methods acquire an exclusive lock on the
206+
queue and return a read-only view of the queue. The view holds the exclusive
207+
lock until disposed.
205208

206209
```csharp
207210
using var view = queue.Inspect();
@@ -244,6 +247,8 @@ A `DependencyQueue<T>` instance has four possible states:
244247

245248
### Thread Safety
246249

250+
Most methods of `DependencyQueue<T>` are thread-safe. Specifically:
251+
247252
- The object returned by `CreateEntryBuilder()` is not thread-safe, but
248253
multiple threads can each use their own builder instance to enqueue items in
249254
parallel.
@@ -253,6 +258,9 @@ A `DependencyQueue<T>` instance has four possible states:
253258
- All dequeue methods (`TryDequeue()`, `TryDequeueAsync()`, `Run()`,
254259
`RunAsync()`, and `Complete()`) are thread-safe.
255260

261+
- All inspection methods (`Inspect()` and `InspectAsync()`) are thread-safe, as
262+
are the objects they return.
263+
256264
- `SetEnding()` is thread-safe.
257265

258266
- `Dispose()` is not thread-safe.

0 commit comments

Comments
 (0)