receive.Rd
If x is missing, blocking pops the oldest Message object from the communication queue as created by start
.
An open connection with the sender may be maintained if keep_conn is set to TRUE
.
Alternatively, if an existing connection as given by a FD
object is passed as x, then the file descriptor is listened on.
S3 method dispatching on x.
receive(x, keep_conn = FALSE, simplify = TRUE, ...)
receive.FD(x, keep_conn=FALSE, simplify=TRUE,...)
If from the message queue, a Message, composed of components:
Arbitrary otherwise.
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, keep_conn = FALSE, simplify = TRUE, ...)
{
stopifnot(ORCV_GLOBAL$STARTED)
if (missing(x)) {
next_msg <- .Call(C_next_message)
if (is.null(next_msg))
stop("receive error")
msg <- as.Message(next_msg)
cat(sprintf("Opening message with header \"%s\"\n", header(msg)))
if (!keep_conn) {
close(msg)
fd(msg) <- as.FD(-1L)
}
if (!simplify)
msg <- list(msg)
invisible(msg)
}
else UseMethod("receive", x)
}
#> function (x, keep_conn = FALSE, simplify = TRUE, ...)
#> {
#> stopifnot(ORCV_GLOBAL$STARTED)
#> if (missing(x)) {
#> next_msg <- .Call(C_next_message)
#> if (is.null(next_msg))
#> stop("receive error")
#> msg <- as.Message(next_msg)
#> cat(sprintf("Opening message with header \"%s\"\n", header(msg)))
#> if (!keep_conn) {
#> close(msg)
#> fd(msg) <- as.FD(-1L)
#> }
#> if (!simplify)
#> msg <- list(msg)
#> invisible(msg)
#> }
#> else UseMethod("receive", x)
#> }
#> <environment: 0x55c14d44a828>