Query whether an Aio or Aio value remains unresolved. Unlike call_aio, this function does not wait for completion.

unresolved(aio)

Arguments

aio

an Aio (object of class 'sendAio' or 'recvAio'), or Aio value stored in $result or $data as the case may be.

Value

Logical TRUE if 'aio' is an unresolved Aio or Aio value, or FALSE otherwise.

Details

Suitable for use in control flow statements such as while or if.

Note: querying resolution may cause a previously unresolved Aio to resolve.

Examples

s1 <- socket("pair", listen = "inproc://nanonext")
aio <- send_aio(s1, "test", timeout = 100)

while (unresolved(aio)) {
  # do stuff before checking resolution again
  cat("unresolved\n")
  msleep(20)
}
#> unresolved
#> unresolved
#> unresolved
#> unresolved
#> unresolved

unresolved(aio)
#> [1] FALSE

close(s1)