Skip to content

Commit 6db1f61

Browse files
committed
Address comments
1 parent 53e00d7 commit 6db1f61

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

R/pkg/inst/worker/daemon.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ while (TRUE) {
5656
# any worker is running or right before launching other worker children from the following
5757
# new socket connection.
5858

59-
# Only the process IDs of exited children are returned and the termination is attempted below.
59+
# Only the process IDs of children sent data to the parent are returned below. The children
60+
# send a custom exit code to the parent after being exited and the parent tries
61+
# to terminate them only if they sent the exit code.
6062
children <- parallel:::selectChildren(timeout = 0)
63+
6164
if (is.integer(children)) {
62-
# If it is PIDs, there are workers exited but not terminated. Attempts to terminate them
63-
# by setting SIGUSR1.
6465
lapply(children, function(child) {
6566
# This data should be raw bytes if any data was sent from this child.
6667
# Otherwise, this returns the PID.
6768
data <- parallel:::readChild(child)
6869
if (is.raw(data)) {
69-
# This checks if the data from this child is -1 that indecides an exited child.
70+
# This checks if the data from this child is the exit code that indicates an exited child.
7071
if (unserialize(data) == exitCode) {
7172
# If so, we terminate this child.
7273
tools::pskill(child, tools::SIGUSR1)

0 commit comments

Comments
 (0)