@@ -263,9 +263,11 @@ has_refinement(F::UmfpackLU) = has_refinement(F.control)
263263has_refinement (control:: AbstractVector ) = control[JL_UMFPACK_IRSTEP] > 0
264264
265265# auto magick resize, should this only expand and not shrink?
266- getworkspace (F:: UmfpackLU ) = @lock F. lock begin
267- return resize! (F. workspace, F, has_refinement (F); expand_only= true )
266+ function getworkspace (F:: UmfpackLU )
267+ @lock F. lock begin
268+ return resize! (F. workspace, F, has_refinement (F); expand_only = true )
268269 end
270+ end
269271
270272UmfpackWS (F:: UmfpackLU{Tv, Ti} , refinement:: Bool = has_refinement (F)) where {Tv, Ti} = UmfpackWS (
271273 Vector {Ti} (undef, size (F, 2 )),
@@ -297,29 +299,12 @@ Base.copy(F::T, ws=UmfpackWS(F)) where {T <: ATLU} =
297299
298300Base. transpose (F:: UmfpackLU ) = TransposeFactorization (F)
299301
300- function Base. lock (f:: Function , F:: UmfpackLU )
301- lock (F)
302- try
303- f ()
304- finally
305- unlock (F)
306- end
307- end
308- Base. lock (F:: UmfpackLU ) = if ! trylock (F. lock)
309- @info """ waiting for UmfpackLU's lock, it's safe to ignore this message.
310- see the documentation for Umfpack""" maxlog = 1
311- lock (F. lock)
312- end
313-
314- @inline Base. trylock (F:: UmfpackLU ) = trylock (F. lock)
315- @inline Base. unlock (F:: UmfpackLU ) = unlock (F. lock)
316-
317302show_umf_ctrl (F:: UmfpackLU , level:: Real = 2.0 ) =
318- @lock F show_umf_ctrl (F. control, level)
303+ @lock F. lock show_umf_ctrl (F. control, level)
319304
320305
321306show_umf_info (F:: UmfpackLU , level:: Real = 2.0 ) =
322- @lock F show_umf_info (F. control, F. info, level)
307+ @lock F. lock show_umf_info (F. control, F. info, level)
323308
324309
325310"""
@@ -598,7 +583,7 @@ for itype in UmfpackIndexTypes
598583 @eval begin
599584 function umfpack_symbolic! (U:: UmfpackLU{Float64,$itype} , q:: Union{Nothing, StridedVector{$itype}} )
600585 _isnotnull (U. symbolic) && return U
601- @lock U begin
586+ @lock U. lock begin
602587 tmp = Ref {Ptr{Cvoid}} (C_NULL )
603588 if q === nothing
604589 @isok $ sym_r (U. m, U. n, U. colptr, U. rowval, U. nzval, tmp, U. control, U. info)
@@ -613,7 +598,7 @@ for itype in UmfpackIndexTypes
613598 end
614599 function umfpack_symbolic! (U:: UmfpackLU{ComplexF64,$itype} , q:: Union{Nothing, StridedVector{$itype}} )
615600 _isnotnull (U. symbolic) && return U
616- @lock U begin
601+ @lock U. lock begin
617602 tmp = Ref {Ptr{Cvoid}} (C_NULL )
618603 if q === nothing
619604 @isok $ sym_c (U. m, U. n, U. colptr, U. rowval, real (U. nzval), imag (U. nzval), tmp,
@@ -627,7 +612,7 @@ for itype in UmfpackIndexTypes
627612 return U
628613 end
629614 function umfpack_numeric! (U:: UmfpackLU{Float64,$itype} ; reuse_numeric= true , q= nothing )
630- @lock U begin
615+ @lock U. lock begin
631616 (reuse_numeric && _isnotnull (U. numeric)) && return U
632617 if _isnull (U. symbolic)
633618 umfpack_symbolic! (U, q)
@@ -643,7 +628,7 @@ for itype in UmfpackIndexTypes
643628 return U
644629 end
645630 function umfpack_numeric! (U:: UmfpackLU{ComplexF64,$itype} ; reuse_numeric= true , q= nothing )
646- @lock U begin
631+ @lock U. lock begin
647632 (reuse_numeric && _isnotnull (U. numeric)) && return U
648633 _isnull (U. symbolic) && umfpack_symbolic! (U, q)
649634 tmp = Ref {Ptr{Cvoid}} (C_NULL )
@@ -672,7 +657,7 @@ for itype in UmfpackIndexTypes
672657 if workspace_W_size (lu) > length (workspace. W)
673658 throw (ArgumentError (" W should be larger than `workspace_W_size(Af)`" ))
674659 end
675- @lock lu begin
660+ @lock lu. lock begin
676661 umfpack_numeric! (lu)
677662 (size (b, 1 ) == lu. m) && (size (b) == size (x)) || throw (DimensionMismatch ())
678663
@@ -697,7 +682,7 @@ for itype in UmfpackIndexTypes
697682 if workspace_W_size (lu) > length (workspace. W)
698683 throw (ArgumentError (" W should be larger than `workspace_W_size(Af)`" ))
699684 end
700- @lock lu begin
685+ @lock lu. lock begin
701686 umfpack_numeric! (lu)
702687 (size (b, 1 ) == lu. m) && (size (b) == size (x)) || throw (DimensionMismatch ())
703688 @isok $ wsol_c (typ, lu. colptr, lu. rowval, lu. nzval, C_NULL , x, C_NULL , b,
@@ -707,14 +692,14 @@ for itype in UmfpackIndexTypes
707692 end
708693 function det (lu:: UmfpackLU{Float64,$itype} )
709694 mx = Ref {Float64} (zero (Float64))
710- @lock lu @isok ($ det_r (mx, C_NULL , lu. numeric, lu. info))
695+ @lock lu. lock @isok ($ det_r (mx, C_NULL , lu. numeric, lu. info))
711696 mx[]
712697 end
713698
714699 function det (lu:: UmfpackLU{ComplexF64,$itype} )
715700 mx = Ref {Float64} (zero (Float64))
716701 mz = Ref {Float64} (zero (Float64))
717- @lock lu @isok ($ det_z (mx, mz, C_NULL , lu. numeric, lu. info))
702+ @lock lu. lock @isok ($ det_z (mx, mz, C_NULL , lu. numeric, lu. info))
718703 complex (mx[], mz[])
719704 end
720705 function logabsdet (F:: UmfpackLU{T, $itype} ) where {T<: Union{Float64,ComplexF64} } # return log(abs(det)) and sign(det)
@@ -1030,7 +1015,7 @@ for Tv in (:Float64, :ComplexF64), Ti in UmfpackIndexTypes
10301015
10311016 _report_symbolic = Symbol (umf_nm (" report_symbolic" , Tv, Ti))
10321017 @eval umfpack_report_symbolic (lu:: UmfpackLU{$Tv,$Ti} , level:: Real = 4 ; q= nothing ) =
1033- @lock lu begin
1018+ @lock lu. lock begin
10341019 umfpack_symbolic! (lu, q)
10351020 old_prl = lu. control[JL_UMFPACK_PRL]
10361021 lu. control[JL_UMFPACK_PRL] = level
@@ -1040,7 +1025,7 @@ for Tv in (:Float64, :ComplexF64), Ti in UmfpackIndexTypes
10401025 end
10411026 _report_numeric = Symbol (umf_nm (" report_numeric" , Tv, Ti))
10421027 @eval umfpack_report_numeric (lu:: UmfpackLU{$Tv,$Ti} , level:: Real = 4 ; q= nothing ) =
1043- @lock lu begin
1028+ @lock lu. lock begin
10441029 umfpack_numeric! (lu; q)
10451030 old_prl = lu. control[JL_UMFPACK_PRL]
10461031 lu. control[JL_UMFPACK_PRL] = level
0 commit comments