| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/aio.R |
| 3 |
\name{collect_aio} |
| 4 |
\alias{collect_aio} |
| 5 |
\alias{collect_aio_} |
| 6 |
\title{Collect Data of an Aio or List of Aios} |
| 7 |
\usage{ |
| 8 |
collect_aio(x) |
| 9 |
|
| 10 |
collect_aio_(x) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{x}{an Aio or list of Aios (objects of class 'sendAio', 'recvAio' or |
| 14 |
'ncurlAio').} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
Depending on the type of \code{x} supplied, an object or list of objects |
| 18 |
(the same length as \code{x}, preserving names). |
| 19 |
} |
| 20 |
\description{ |
| 21 |
\code{collect_aio} collects the data of an Aio or list of Aios, waiting for |
| 22 |
resolution if still in progress. |
| 23 |
|
| 24 |
\code{collect_aio_} is a variant that allows user interrupts, suitable for |
| 25 |
interactive use. |
| 26 |
} |
| 27 |
\details{ |
| 28 |
This function will wait for the asynchronous operation(s) to complete if |
| 29 |
still in progress (blocking). |
| 30 |
|
| 31 |
Using \code{x[]} on an Aio \code{x} is equivalent to the user-interruptible |
| 32 |
\code{collect_aio_(x)}. |
| 33 |
} |
| 34 |
\examples{ |
| 35 |
s1 <- socket("pair", listen = "inproc://nanonext") |
| 36 |
s2 <- socket("pair", dial = "inproc://nanonext") |
| 37 |
|
| 38 |
res <- send_aio(s1, data.frame(a = 1, b = 2), timeout = 100) |
| 39 |
collect_aio(res) |
| 40 |
|
| 41 |
msg <- recv_aio(s2, timeout = 100) |
| 42 |
collect_aio_(msg) |
| 43 |
|
| 44 |
msg[] |
| 45 |
|
| 46 |
close(s1) |
| 47 |
close(s2) |
| 48 |
|
| 49 |
} |