Learn R Programming

nanonext (version 1.5.2)

unresolved: Query if an Aio is Unresolved

Description

Query whether an Aio, Aio value or list of Aios remains unresolved. Unlike call_aio(), this function does not wait for completion.

Usage

unresolved(x)

Value

Logical TRUE if x is an unresolved Aio or Aio value or the list of Aios contains at least one unresolved Aio, or FALSE otherwise.

Arguments

x

an Aio or list of Aios (objects of class 'sendAio', 'recvAio' or 'ncurlAio'), or Aio value stored at $result or $data etc.

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

Run this code
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(aio)

close(s1)

Run the code above in your browser using DataLab