Skip to content

Commit

Permalink
simplify daemon termination
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jan 8, 2025
1 parent 8f33e47 commit 40e0909
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mirai
Type: Package
Title: Minimalist Async Evaluation Framework for R
Version: 1.3.1.9027
Version: 1.3.1.9028
Description: Designed for simplicity, a 'mirai' evaluates an R expression
asynchronously in a parallel process, locally or distributed over the
network, with the result automatically available upon completion. Modern
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 1.3.1.9027 (development)
# mirai 1.3.1.9028 (development)

#### New Architecture

Expand Down
8 changes: 1 addition & 7 deletions R/daemon.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,7 @@ daemon <- function(url, dispatcher = FALSE, ..., asyncdial = FALSE, autoexit = T
cancel <- recv_aio(sock, mode = 8L, cv = NA)
data <- eval_mirai(m)
stop_aio(cancel)
{ task >= maxtasks || maxtime && mclock() >= maxtime } && {
.mark()
send(sock, data, mode = 1L, block = TRUE)
aio <- recv_aio(sock, mode = 8L, cv = cv)
wait(cv)
break
}
{ task >= maxtasks || maxtime && mclock() >= maxtime } && .mark()
send(sock, data, mode = 1L, block = TRUE)
if (cleanup) do_cleanup()
task <- task + 1L
Expand Down
2 changes: 1 addition & 1 deletion R/dispatcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ dispatcher <- function(host, url = NULL, n = NULL, ..., tls = NULL, pass = NULL,
send(outq[[id]][["ctx"]], value, mode = 2L, block = TRUE)
outq[[id]][["msgid"]] <- 0L
if (value[4L]) {
send(psock, 0L, mode = 2L, pipe = outq[[id]][["pipe"]], block = TRUE)
send(psock, ._scm_., mode = 2L, pipe = outq[[id]][["pipe"]], block = TRUE)
outq[[id]] <- NULL
}
}
Expand Down

0 comments on commit 40e0909

Please sign in to comment.