@@ -711,10 +711,10 @@ mutable struct OncePerProcess{T, F} <: Function
711711end
712712OncePerProcess {T} (initializer:: F ) where {T, F} = OncePerProcess {T, F} (initializer)
713713OncePerProcess (initializer) = OncePerProcess {Base.promote_op(initializer), typeof(initializer)} (initializer)
714- @inline function (once:: OncePerProcess{T} )() where T
714+ @inline function (once:: OncePerProcess{T,F } )() where {T,F}
715715 state = (@atomic :acquire once. state)
716716 if state != PerStateHasrun
717- (@noinline function init_perprocesss (once, state)
717+ (@noinline function init_perprocesss (once:: OncePerProcess{T,F} , state:: UInt8 ) where {T,F}
718718 state == PerStateErrored && error (" OncePerProcess initializer failed previously" )
719719 once. allow_compile_time || __precompile__ (false )
720720 lock (once. lock)
@@ -818,14 +818,14 @@ mutable struct OncePerThread{T, F} <: Function
818818end
819819OncePerThread {T} (initializer:: F ) where {T, F} = OncePerThread {T,F} (initializer)
820820OncePerThread (initializer) = OncePerThread {Base.promote_op(initializer), typeof(initializer)} (initializer)
821- @inline (once:: OncePerThread )() = once[Threads. threadid ()]
822- @inline function getindex (once:: OncePerThread , tid:: Integer )
821+ @inline (once:: OncePerThread{T,F} )() where {T,F} = once[Threads. threadid ()]
822+ @inline function getindex (once:: OncePerThread{T,F} , tid:: Integer ) where {T,F}
823823 tid = Int (tid)
824824 ss = @atomic :acquire once. ss
825825 xs = @atomic :monotonic once. xs
826826 # n.b. length(xs) >= length(ss)
827827 if tid <= 0 || tid > length (ss) || (@atomic :acquire ss[tid]) != PerStateHasrun
828- (@noinline function init_perthread (once, tid)
828+ (@noinline function init_perthread (once:: OncePerThread{T,F} , tid:: Int ) where {T,F}
829829 local ss = @atomic :acquire once. ss
830830 local xs = @atomic :monotonic once. xs
831831 local len = length (ss)
@@ -933,6 +933,6 @@ mutable struct OncePerTask{T, F} <: Function
933933 OncePerTask {T,F} (initializer:: F ) where {T, F} = new {T,F} (initializer)
934934 OncePerTask (initializer) = new {Base.promote_op(initializer), typeof(initializer)} (initializer)
935935end
936- @inline function (once:: OncePerTask{T} )() where {T}
936+ @inline function (once:: OncePerTask{T,F } )() where {T,F }
937937 get! (once. initializer, task_local_storage (), once):: T
938938end
0 commit comments