Skip to content

Commit a0e17e9

Browse files
include busywait def in example
1 parent be14f3c commit a0e17e9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

base/threadingconstructs.jl

+6
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ For example, an illustration of the different scheduling strategies where `busyw
147147
is a non-yielding timed loop that runs for a number of seconds.
148148
149149
```julia-repl
150+
julia> function busywait(seconds)
151+
tstart = Base.time()
152+
while Base.time() - tstart < seconds
153+
end
154+
end
155+
150156
julia> @time begin
151157
Threads.@spawn busywait(5)
152158
Threads.@threads :static for i in 1:Threads.nthreads()

0 commit comments

Comments
 (0)