Skip to content

Commit

Permalink
un-doctest examples that aren't guaranteed threaded output order
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jan 18, 2025
1 parent 860bbc5 commit d9a7549
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/src/manual/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ While the streaming I/O API is synchronous, the underlying implementation is ful

Consider the printed output from the following:

```jldoctest
```
julia> @sync for i in 1:3
Threads.@spawn write(stdout, string(i), " Foo ", " Bar ")
end
Expand All @@ -954,7 +954,7 @@ yields to other tasks while waiting for that part of the I/O to complete.
`print` and `println` "lock" the stream during a call. Consequently changing `write` to `println`
in the above example results in:

```jldoctest
```
julia> @sync for i in 1:3
Threads.@spawn println(stdout, string(i), " Foo ", " Bar ")
end
Expand All @@ -965,7 +965,7 @@ julia> @sync for i in 1:3

You can lock your writes with a `ReentrantLock` like this:

```jldoctest
```
julia> l = ReentrantLock();
julia> @sync for i in 1:3
Expand Down

0 comments on commit d9a7549

Please sign in to comment.