File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
stdlib/LinearAlgebra/test Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -651,16 +651,16 @@ end
651651
652652 @testset " thread unsafe" begin
653653 prev_num_threads = BLAS. get_num_threads ()
654- # thread unsafe
655- @async BLAS. with_num_threads (1 ) do
654+ context_num_threads = 1
655+ # task A
656+ t = @async BLAS. with_num_threads (context_num_threads) do
656657 sleep (0.5 )
657658 end
658659 sleep (0.1 )
659-
660- context_num_threads = BLAS. get_num_threads ()
661- @test context_num_threads == 1
662-
663- sleep (0.5 ) # wait for the task to finish
660+ # check that main thread is affected by task A
661+ @test BLAS. get_num_threads () == context_num_threads
662+ # when the task finishes, the num threads get restored
663+ wait (t)
664664 @test prev_num_threads == BLAS. get_num_threads ()
665665 end
666666end
You can’t perform that action at this time.
0 commit comments