From 5fffa440d9f85ac05b55b4e1e79c1a93cf2e12a6 Mon Sep 17 00:00:00 2001 From: JohnnyChen Date: Wed, 3 Nov 2021 19:33:00 +0800 Subject: [PATCH] apply suggestions on simplifying the implementation --- stdlib/LinearAlgebra/src/blas.jl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/stdlib/LinearAlgebra/src/blas.jl b/stdlib/LinearAlgebra/src/blas.jl index 1078fa10da111..9f08786a5d960 100644 --- a/stdlib/LinearAlgebra/src/blas.jl +++ b/stdlib/LinearAlgebra/src/blas.jl @@ -202,15 +202,13 @@ number of BLAS threads. function with_num_threads(f, num_threads::Integer) prev_num_threads = BLAS.get_num_threads() BLAS.set_num_threads(num_threads) - local retval try - retval = f() - catch err - rethrow(err) + return f() + catch + rethrow() finally BLAS.set_num_threads(prev_num_threads) end - return retval end # Level 1