# WaitIO

Waits for an I/O request to complete.

### Synopsis

`Err WaitIO( Item ior )`

### Description

The procedure puts the calling task into wait state until the specified I/O request completes. When a task is in wait state, it uses no CPU time.

Note: If the I/O request has already completed, the procedure returns immediately. If the I/O request never completes and it is not aborted, the procedure never returns.

Starting with kernel folio V24, this function will automatically sample the io_Error field of the IO request, and return this to you. It is, therefore, no longer necessary to have code such as:

``

    err = WaitIO(iorItem);
    if (err > = 0)

`

    err = ior->io_Error;

` You can now just look at the return value of `WaitIO()`.

### Arguments

ior
  The item number of the I/O request to wait for.

### Return Value

The procedure returns a value greater than or equal to 0 if the I/O request was successful or an error code if an error occurs.

### Implementation

Convenience call implemented in clib.lib V20. Became a SWI in kernel folio V24.

### Associated Files

io.h
  ANSI C Prototype

clib.lib
  ARM Link Library

### See Also

``AbortIO`(), CheckIO(), DoIO(), SendIO()`

#