From e2c340d7e5f03b50155e47af81f361a177a77eef Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Wed, 27 Sep 2023 12:29:11 +0200 Subject: [PATCH] Display pid in summary(worker) --- src/Malt.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Malt.jl b/src/Malt.jl index 57dd56b..3591a36 100644 --- a/src/Malt.jl +++ b/src/Malt.jl @@ -90,6 +90,7 @@ Malt.Worker(0x0000, Process(`…`, ProcessRunning)) mutable struct Worker <: AbstractWorker port::UInt16 proc::Base.Process + proc_pid::Int32 current_socket::Sockets.TCPSocket # socket_lock::ReentrantLock @@ -117,7 +118,14 @@ mutable struct Worker <: AbstractWorker # There's no reason to keep the worker process alive after the manager loses its handle. w = finalizer(w -> @async(stop(w)), - new(port, proc, socket, MsgID(0), Dict{MsgID,Channel{WorkerResult}}()) + new( + port, + proc, + getpid(proc), + socket, + MsgID(0), + Dict{MsgID,Channel{WorkerResult}}(), + ) ) atexit(() -> stop(w)) @@ -127,7 +135,7 @@ mutable struct Worker <: AbstractWorker end end -Base.summary(io::IO, w::Worker) = write(io, "Malt.Worker on port $(w.port)") +Base.summary(io::IO, w::Worker) = write(io, "Malt.Worker on port $(w.port) with PID $(w.proc_pid)") function _receive_loop(worker::Worker)