result = CheckIO(iORequest)
D0 A1
struct IORequest *CheckIO(struct IORequest *);
This function determines the current state of an I/O request and returns NULL if the I/O has not yet completed. This function effectively hides the internals of the I/O completion mechanism.
CheckIO() will NOT remove the returned IORequest from the reply port. This is best performed with
WaitIO(). If the request has already completed,
WaitIO() will return quickly. Use of the
Remove() function is dangerous, since other Tasks may still be adding things to your message port; a
Disable() would be required.
This function should NOT be used to busy loop (looping until IO is complete).
WaitIO() is provided for that purpose.
CheckIO() can hang if called on an IORequest that has never been used. This occurs if io_Message.mn_Node.ln_Type of the IORequest is set to "NT_MESSAGE". Instead simply set LN_TYPE to 0.
if (CheckIO(timer_request) == NULL)
{
AbortIO(timer_request);
WaitIO(timer_request);
/* Message is free to be reused */
}
else
{
/* Message is not currently in use */
}
For Kickstart 1.x CheckIO() used to be documented to return a BOOL result. This was never correct and could lead to undefined behaviour for I/O requests whose address was a multiple of 65536.