@@ -261,9 +261,11 @@ has_refinement(F::UmfpackLU) = has_refinement(F.control)
261261has_refinement (control:: AbstractVector ) = control[JL_UMFPACK_IRSTEP] > 0
262262
263263# auto magick resize, should this only expand and not shrink?
264- getworkspace (F:: UmfpackLU ) = @lock F. lock begin
265- return resize! (F. workspace, F, has_refinement (F); expand_only= true )
264+ function getworkspace (F:: UmfpackLU )
265+ @lock F. lock begin
266+ return resize! (F. workspace, F, has_refinement (F); expand_only = true )
266267 end
268+ end
267269
268270UmfpackWS (F:: UmfpackLU{Tv, Ti} , refinement:: Bool = has_refinement (F)) where {Tv, Ti} = UmfpackWS (
269271 Vector {Ti} (undef, size (F, 2 )),
@@ -295,29 +297,12 @@ Base.copy(F::T, ws=UmfpackWS(F)) where {T <: ATLU} =
295297
296298Base. transpose (F:: UmfpackLU ) = TransposeFactorization (F)
297299
298- function Base. lock (f:: Function , F:: UmfpackLU )
299- lock (F)
300- try
301- f ()
302- finally
303- unlock (F)
304- end
305- end
306- Base. lock (F:: UmfpackLU ) = if ! trylock (F. lock)
307- @info """ waiting for UmfpackLU's lock, it's safe to ignore this message.
308- see the documentation for Umfpack""" maxlog = 1
309- lock (F. lock)
310- end
311-
312- @inline Base. trylock (F:: UmfpackLU ) = trylock (F. lock)
313- @inline Base. unlock (F:: UmfpackLU ) = unlock (F. lock)
314-
315300show_umf_ctrl (F:: UmfpackLU , level:: Real = 2.0 ) =
316- @lock F show_umf_ctrl (F. control, level)
301+ @lock F. lock show_umf_ctrl (F. control, level)
317302
318303
319304show_umf_info (F:: UmfpackLU , level:: Real = 2.0 ) =
320- @lock F show_umf_info (F. control, F. info, level)
305+ @lock F. lock show_umf_info (F. control, F. info, level)
321306
322307
323308"""
@@ -584,7 +569,7 @@ for itype in UmfpackIndexTypes
584569 @eval begin
585570 function umfpack_symbolic! (U:: UmfpackLU{Float64,$itype} , q:: Union{Nothing, StridedVector{$itype}} )
586571 _isnotnull (U. symbolic) && return U
587- @lock U begin
572+ @lock U. lock begin
588573 tmp = Ref {Ptr{Cvoid}} (C_NULL )
589574 if q === nothing
590575 @isok $ sym_r (U. m, U. n, U. colptr, U. rowval, U. nzval, tmp, U. control, U. info)
@@ -599,7 +584,7 @@ for itype in UmfpackIndexTypes
599584 end
600585 function umfpack_symbolic! (U:: UmfpackLU{ComplexF64,$itype} , q:: Union{Nothing, StridedVector{$itype}} )
601586 _isnotnull (U. symbolic) && return U
602- @lock U begin
587+ @lock U. lock begin
603588 tmp = Ref {Ptr{Cvoid}} (C_NULL )
604589 if q === nothing
605590 @isok $ sym_c (U. m, U. n, U. colptr, U. rowval, real (U. nzval), imag (U. nzval), tmp,
@@ -613,7 +598,7 @@ for itype in UmfpackIndexTypes
613598 return U
614599 end
615600 function umfpack_numeric! (U:: UmfpackLU{Float64,$itype} ; reuse_numeric= true , q= nothing )
616- @lock U begin
601+ @lock U. lock begin
617602 (reuse_numeric && _isnotnull (U. numeric)) && return U
618603 if _isnull (U. symbolic)
619604 umfpack_symbolic! (U, q)
@@ -629,7 +614,7 @@ for itype in UmfpackIndexTypes
629614 return U
630615 end
631616 function umfpack_numeric! (U:: UmfpackLU{ComplexF64,$itype} ; reuse_numeric= true , q= nothing )
632- @lock U begin
617+ @lock U. lock begin
633618 (reuse_numeric && _isnotnull (U. numeric)) && return U
634619 _isnull (U. symbolic) && umfpack_symbolic! (U, q)
635620 tmp = Ref {Ptr{Cvoid}} (C_NULL )
@@ -658,7 +643,7 @@ for itype in UmfpackIndexTypes
658643 if workspace_W_size (lu) > length (workspace. W)
659644 throw (ArguementError (" W should be larger than `workspace_W_size(Af)`" ))
660645 end
661- @lock lu begin
646+ @lock lu. lock begin
662647 umfpack_numeric! (lu)
663648 (size (b, 1 ) == lu. m) && (size (b) == size (x)) || throw (DimensionMismatch ())
664649
@@ -683,7 +668,7 @@ for itype in UmfpackIndexTypes
683668 if workspace_W_size (lu) > length (workspace. W)
684669 throw (ArguementError (" W should be larger than `workspace_W_size(Af)`" ))
685670 end
686- @lock lu begin
671+ @lock lu. lock begin
687672 umfpack_numeric! (lu)
688673 (size (b, 1 ) == lu. m) && (size (b) == size (x)) || throw (DimensionMismatch ())
689674 @isok $ wsol_c (typ, lu. colptr, lu. rowval, lu. nzval, C_NULL , x, C_NULL , b,
@@ -693,14 +678,14 @@ for itype in UmfpackIndexTypes
693678 end
694679 function det (lu:: UmfpackLU{Float64,$itype} )
695680 mx = Ref {Float64} (zero (Float64))
696- @lock lu @isok ($ det_r (mx, C_NULL , lu. numeric, lu. info))
681+ @lock lu. lock @isok ($ det_r (mx, C_NULL , lu. numeric, lu. info))
697682 mx[]
698683 end
699684
700685 function det (lu:: UmfpackLU{ComplexF64,$itype} )
701686 mx = Ref {Float64} (zero (Float64))
702687 mz = Ref {Float64} (zero (Float64))
703- @lock lu @isok ($ det_z (mx, mz, C_NULL , lu. numeric, lu. info))
688+ @lock lu. lock @isok ($ det_z (mx, mz, C_NULL , lu. numeric, lu. info))
704689 complex (mx[], mz[])
705690 end
706691 function logabsdet (F:: UmfpackLU{T, $itype} ) where {T<: Union{Float64,ComplexF64} } # return log(abs(det)) and sign(det)
@@ -1016,7 +1001,7 @@ for Tv in (:Float64, :ComplexF64), Ti in UmfpackIndexTypes
10161001
10171002 _report_symbolic = Symbol (umf_nm (" report_symbolic" , Tv, Ti))
10181003 @eval umfpack_report_symbolic (lu:: UmfpackLU{$Tv,$Ti} , level:: Real = 4 ; q= nothing ) =
1019- @lock lu begin
1004+ @lock lu. lock begin
10201005 umfpack_symbolic! (lu, q)
10211006 old_prl = lu. control[JL_UMFPACK_PRL]
10221007 lu. control[JL_UMFPACK_PRL] = level
@@ -1026,7 +1011,7 @@ for Tv in (:Float64, :ComplexF64), Ti in UmfpackIndexTypes
10261011 end
10271012 _report_numeric = Symbol (umf_nm (" report_numeric" , Tv, Ti))
10281013 @eval umfpack_report_numeric (lu:: UmfpackLU{$Tv,$Ti} , level:: Real = 4 ; q= nothing ) =
1029- @lock lu begin
1014+ @lock lu. lock begin
10301015 umfpack_numeric! (lu; q)
10311016 old_prl = lu. control[JL_UMFPACK_PRL]
10321017 lu. control[JL_UMFPACK_PRL] = level
0 commit comments