Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display pid in summary(worker) #62

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Malt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand All @@ -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)
Expand Down
Loading