2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: Wait until IO request completes.
8 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
17 AROS_LH1(LONG
, WaitIO
,
20 AROS_LHA(struct IORequest
*, iORequest
, A1
),
23 struct ExecBase
*, SysBase
, 79, Exec
)
26 Waits until the I/O request is completed and removes it from the
27 reply port. If the message is already done when calling this function,
28 it doesn't wait but just removes the message.
31 iORequest - Pointer to iorequest structure.
34 Error state of I/O request.
37 OpenDevice() notes explain LONG return type.
44 OpenDevice(), CloseDevice(), DoIO(), SendIO(), AbortIO(), CheckIO()
48 ******************************************************************************/
53 The I/O request is still in use if it wasn't done quick
54 and isn't yet replied (ln_Type==NT_MESSAGE).
55 If it is still in use wait until it is complete.
56 Note that the port may be used for other things as well - so
57 don't just wait but repeat the check.
59 while(!(iORequest
->io_Flags
&IOF_QUICK
)&&
60 iORequest
->io_Message
.mn_Node
.ln_Type
==NT_MESSAGE
)
62 Wait at the reply port. Don't use WaitPort() - there may
63 already be other messages waiting at it.
65 Wait(1<<iORequest
->io_Message
.mn_ReplyPort
->mp_SigBit
);
68 If ln_Type is NT_REPLYMSG the I/O request must be removed from
69 the replyport's waiting queue.
71 if(iORequest
->io_Message
.mn_Node
.ln_Type
==NT_REPLYMSG
)
73 /* Arbitrate for the message queue. */
76 /* Remove the message */
77 Remove(&iORequest
->io_Message
.mn_Node
);
81 /* All done. Get returncode. */
82 return iORequest
->io_Error
;