We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e331deb commit 1c24eebCopy full SHA for 1c24eeb
stdlib/Logging/test/runtests.jl
@@ -306,4 +306,14 @@ end
306
@test isempty(undoc)
307
end
308
309
+@testset "thread safety" begin
310
+ cmd = `$(Base.julia_cmd()) -t4 $(joinpath(@__DIR__, "threads_exec.jl"))`
311
+ fname = tempname()
312
+ f = open(fname, "w")
313
+ redirect_stderr(f) do
314
+ success(run(cmd))
315
+ end
316
+ close(f)
317
+end
318
+
319
stdlib/Logging/test/threads_exec.jl
@@ -0,0 +1,13 @@
1
+using Logging
2
3
+function test_threads_exec(n)
4
+ Threads.@threads for i in 1:n
5
+ x = rand()
6
+ @debug "iteration" i x Threads.threadid()
7
+ @info "iteration" i x Threads.threadid()
8
+ @warn "iteration" i x Threads.threadid()
9
+ @error "iteration" i x Threads.threadid()
10
11
12
13
+test_threads_exec(100000)
0 commit comments