2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <dos/notify.h>
11 #include <proto/exec.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
18 #include <proto/dos.h>
20 AROS_LH0I(struct DosPacket
*, WaitPkt
,
26 struct DosLibrary
*, DOSBase
, 42, Dos
)
30 Wait for a packet to arrive at your process' pr_MsgPort. It will call
31 pr_PktWait if such a function is installed.
37 The packet we received.
41 The packet will be released from the port.
43 This function should NOT be used. It's there only for AmigaOS
54 *****************************************************************************/
58 struct Process
*me
= (struct Process
*)FindTask(NULL
);
60 ASSERT_VALID_PROCESS(me
);
62 return internal_WaitPkt(&me
->pr_MsgPort
);
67 struct DosPacket
*internal_WaitPkt(struct MsgPort
*msgPort
)
69 struct Message
*msg
= NULL
;
70 struct Process
*me
= (struct Process
*)FindTask(NULL
);
75 * Call the packet wait function if the user has one installed.
76 * Unfortunately, in case of IOFS the user gets something completely different than
77 * a packet, but we cannot do anything about that...
81 msg
= AROS_UFC3(struct Message
*, me
->pr_PktWait
,
82 AROS_UFCA(APTR
, me
->pr_PktWait
, A0
),
83 AROS_UFCA(struct MsgPort
*, msgPort
, A1
),
84 AROS_UFCA(struct ExecBase
*, SysBase
, A6
));
90 /* Make sure we have a packet -- we may be woken up even if there is
91 not a packet for us as SIGF_DOS may be used and we may have another
92 message port that waits for packets, too. */
93 while ((msg
= GetMsg(msgPort
)) == NULL
)
95 Wait(1 << msgPort
->mp_SigBit
);
99 D(bug("[DOS] WaitPkt(): got DOS packet 0x%p in message 0x%p\n", msg
->mn_Node
.ln_Name
, msg
));
100 return (struct DosPacket
*)msg
->mn_Node
.ln_Name
;