From b468b35f15d9ed7b22804ca43dfccb5072a2c7b1 Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Sat, 28 Dec 2024 22:50:28 +0100 Subject: [PATCH] fixup! Implement an interface for Distributed-like libraries --- Project.toml | 2 +- src/packagedef.jl | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 92f3be5c..bc04e0bf 100644 --- a/Project.toml +++ b/Project.toml @@ -28,7 +28,7 @@ LoweredCodeUtils = "3.0.1" OrderedCollections = "1" # Exclude Requires-1.1.0 - see https://github.com/JuliaPackaging/Requires.jl/issues/94 Requires = "~1.0, ^1.1.1" -julia = "1.9" +julia = "1.10" [extras] CatIndices = "aafaddc9-749c-510e-ac4f-586e18779b91" diff --git a/src/packagedef.jl b/src/packagedef.jl index d6d9a8be..13e3b694 100644 --- a/src/packagedef.jl +++ b/src/packagedef.jl @@ -9,14 +9,18 @@ using Core: CodeInfo export revise, includet, entr, MethodSummary +# Abstract type to represent a single worker +abstract type AbstractWorker end + # Wrapper struct to indicate a worker belonging to the Distributed stdlib. Other -# libraries should make their own types for Revise to dispatch on. -struct DistributedWorker +# libraries should make their own type that subtypes AbstractWorker for Revise +# to dispatch on. +struct DistributedWorker <: AbstractWorker id::Int end # This is a list of functions that will retrieve a list of workers -const workers_functions = Function[] +const workers_functions = Base.Callable[] # A distributed worker library wanting to use Revise should register their # workers() function with this. @@ -1314,7 +1318,7 @@ async_steal_repl_backend() = steal_repl_backend() Define methods on worker `p` that Revise needs in order to perform revisions on `p`. Revise itself does not need to be running on `p`. """ -function init_worker(p) +function init_worker(p::AbstractWorker) remotecall_impl(Core.eval, p, Main, quote function whichtt(@nospecialize sig) @static if VERSION ≥ v"1.10.0-DEV.873"