diff --git a/src/thunk.jl b/src/thunk.jl index 88a7a78a..05d0c7ef 100644 --- a/src/thunk.jl +++ b/src/thunk.jl @@ -7,7 +7,7 @@ end # A thing to run mutable struct Thunk - f::Function + f::Any # usually a Function, but could be any callable inputs::Tuple id::Int get_result::Bool # whether the worker should send the result or only the metadata diff --git a/test/processors.jl b/test/processors.jl index 488ccf3c..2ccd3143 100644 --- a/test/processors.jl +++ b/test/processors.jl @@ -91,6 +91,18 @@ end wait(rmprocs(ps)) end + + @testset "Callable as Thunk function" begin + @everywhere begin + struct ABC end + (::ABC)(x) = x+1 + end + + abc = ABC() + a = delayed(abc)(1) + @test collect(a) == 2 + end + @testset "Processor TLS accessor" begin @everywhere function mythunk(x) typeof(Dagger.thunk_processor())