@@ -133,15 +133,18 @@ stop_aio <- function(aio) {
133133
134134# ' Is Resolved (Asynchronous AIO Operation)
135135# '
136- # ' Query whether an Aio has resolved. This function is non-blocking unlike
137- # ' \code{\link{call_aio}} which waits for completion.
136+ # ' Query whether an Aio or Aio value has resolved. This function is non-blocking
137+ # ' unlike \code{\link{call_aio}} which waits for completion.
138138# '
139- # ' @param aio An Aio (object of class 'sendAio' or 'recvAio').
139+ # ' @param aio An Aio (object of class 'sendAio' or 'recvAio'), or Aio value
140+ # ' stored in \code{$result}, \code{$raw} or \code{$data} as the case may be.
141+ # '
142+ # ' @return Logical TRUE or FALSE.
140143# '
141- # ' @return Logical TRUE or FALSE. NA if 'aio' is not a 'sendAio' or 'recvAio'.
144+ # ' @details Returns FALSE only for unresolved nanonext Aios or Aio values; returns
145+ # ' TRUE in all other cases and for all other objects.
142146# '
143- # ' @details Querying resolution will potentially cause the state of the Aio to
144- # ' update.
147+ # ' Note: querying resolution may cause a previously unresolved Aio to resolve.
145148# '
146149# ' @examples
147150# ' s1 <- socket("pair", listen = "inproc://nanonext")
@@ -159,11 +162,13 @@ stop_aio <- function(aio) {
159162is_resolved <- function (aio ) {
160163
161164 if (inherits(aio , " recvAio" )) {
162- ! inherits(aio $ data , " unresolvedValue" )
165+ ! inherits(.subset2( aio , " data" ) , " unresolvedValue" )
163166 } else if (inherits(aio , " sendAio" )) {
164- ! inherits(aio $ result , " unresolvedValue" )
167+ ! inherits(.subset2(aio , " result" ), " unresolvedValue" )
168+ } else if (inherits(aio , " unresolvedValue" )) {
169+ FALSE
165170 } else {
166- NA
171+ TRUE
167172 }
168173
169174}
0 commit comments