Learn R Programming

nanonext (version 1.3.0)

collect_pipe: Collect the Pipe from an Aio

Description

This function retrieves the Pipe used to receive a message from the Aio. It will block if the Aio has yet to complete. The message is still available for retrieval by the usual means. A Pipe is a low-level object and it is not normally necessary to deal with them directly.

Usage

collect_pipe(x)

Value

A Pipe (object of class ‘nanoPipe’).

Arguments

x

a 'recvAio' object.

Details

As Pipes are always owned by a Socket, removing (and garbage collecting) a Pipe does not close it or free its resources. A Pipe may, however, be explicitly closed.

Examples

Run this code
s <- socket("rep", listen = "inproc://nanonext")
s1 <- socket("req", dial = "inproc://nanonext")

r <- recv_aio(s, timeout = 500)

if (!send(s1, "")) {
  p <- tryCatch(collect_pipe(r), error = identity)
  print(p)
  reap(p)
}

close(s)
close(s1)

Run the code above in your browser using DataLab