Learn R Programming

nanonext (version 0.2.0)

call_aio: Call the Result of an Asynchronous AIO Operation

Description

Retrieve the result of an asynchronous AIO operation. Will wait for the AIO operation to complete (blocking) if this is still in progress.

Usage

call_aio(aio)

Arguments

aio

An Aio (object of class 'sendAio' or 'recvAio').

Value

The passed Aio object (invisibly).

Details

To access the values directly, use for example on a sendAio 'x': call_aio(x)$result.

For a 'sendAio', the send result will be attached to the Aio in $result. This will be zero on success.

For a 'recvAio', the received raw vector will be attached in $raw (unless 'keep.raw' was set to FALSE when receiving), and the converted R object in $data.

For a 'recvAio', in case of an error in unserialisation or data conversion, the received raw vector will always be saved in $raw to allow the data to be recovered.

Once the result is retrieved, the Aio is deallocated and only the result is stored in the Aio object.

Examples

Run this code
# NOT RUN {
s1 <- socket("pair", listen = "inproc://nanonext")
s2 <- socket("pair", dial = "inproc://nanonext")

res <- send_aio(s1, data.frame(a = 1, b = 2), timeout = 100)
res
call_aio(res)
res
res$result

res <- recv_aio(s2, timeout = 100)
res
call_aio(res)$data
res

close(s1)
close(s2)

# }

Run the code above in your browser using DataLab