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
651
651
652
652
@testset " thread unsafe" begin
653
653
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
656
657
sleep (0.5 )
657
658
end
658
659
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)
664
664
@test prev_num_threads == BLAS. get_num_threads ()
665
665
end
666
666
end
You can’t perform that action at this time.
0 commit comments