2 Copyright © 1995-2001, 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(BYTE
, 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 remove the message.
31 iORequest - Pointer to iorequest structure.
34 Error state of I/O request.
43 OpenDevice(), CloseDevice(), DoIO(), SendIO(), AbortIO(), CheckIO()
47 ******************************************************************************/
52 The I/O request is still in use if it wasn't done quick
53 and isn't yet replied (ln_Type==NT_MESSAGE).
54 If it is still in use wait until it is complete.
55 Note the the port may be used for other things as well - so
56 don't just wait but repeat the check.
58 while(!(iORequest
->io_Flags
&IOF_QUICK
)&&
59 iORequest
->io_Message
.mn_Node
.ln_Type
==NT_MESSAGE
)
61 Wait at the reply port. Don't use WaitPort() - there may
62 already be other messages waiting at it.
64 Wait(1<<iORequest
->io_Message
.mn_ReplyPort
->mp_SigBit
);
67 If ln_Type is NT_REPLYMSG the I/O request must be removed from
68 the replyport's waiting queue.
70 if(iORequest
->io_Message
.mn_Node
.ln_Type
==NT_REPLYMSG
)
72 /* Arbitrate for the message queue. */
75 /* Remove the message */
76 Remove(&iORequest
->io_Message
.mn_Node
);
80 /* All done. Get returncode. */
81 return iORequest
->io_Error
;