Skip to content

Commit 97b5e08

Browse files
giordanopankgeorg
authored andcommitted
Make accesses to __iNtErNaL_running_procs thread-safe
1 parent 282d79d commit 97b5e08

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Malt"
22
uuid = "36869731-bdee-424d-aa32-cab38c994e3b"
33
authors = ["Sergio Alejandro Vargas <savargasqu+git@unal.edu.co>", "Fons van der Plas <fons@plutojl.org>"]
4-
version = "1.4.0"
4+
version = "1.4.1"
55

66
[deps]
77
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

src/Malt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ end
7575
Base.summary(io::IO, w::InProcessWorker) = write(io, "Malt.InProcessWorker in module $(w.host_module)")
7676

7777
const __iNtErNaL_running_procs = Set{Base.Process}()
78-
__iNtErNaL_get_running_procs() = filter!(Base.process_running, __iNtErNaL_running_procs)
78+
const procs_lock = ReentrantLock()
79+
__iNtErNaL_get_running_procs() = Base.@lock procs_lock filter!(Base.process_running, __iNtErNaL_running_procs)
7980

8081
"""
8182
Malt.Worker()
@@ -134,7 +135,7 @@ mutable struct Worker <: AbstractWorker
134135

135136
# Keep internal list
136137
__iNtErNaL_get_running_procs()
137-
push!(__iNtErNaL_running_procs, proc)
138+
Base.@lock procs_lock push!(__iNtErNaL_running_procs, proc)
138139

139140
yield() # https://github.com/fonsp/Pluto.jl/issues/3423
140141

0 commit comments

Comments
 (0)