2 Copyright © 1995-2013, 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
)
29 Wait for a packet to arrive at your process's pr_MsgPort. It will call
30 pr_PktWait if such a function is installed.
36 packet - The packet we received.
39 The packet will be released from the port.
41 This function should NOT be used. It's there only for AmigaOS
52 *****************************************************************************/
56 struct Process
*me
= (struct Process
*)FindTask(NULL
);
58 ASSERT_VALID_PROCESS(me
);
60 return internal_WaitPkt(&me
->pr_MsgPort
);
65 struct DosPacket
*internal_WaitPkt(struct MsgPort
*msgPort
)
67 struct Message
*msg
= NULL
;
68 struct Process
*me
= (struct Process
*)FindTask(NULL
);
73 * Call the packet wait function if the user has one installed.
74 * Unfortunately, in case of IOFS the user gets something completely different than
75 * a packet, but we cannot do anything about that...
79 msg
= AROS_UFC3(struct Message
*, me
->pr_PktWait
,
80 AROS_UFCA(APTR
, me
->pr_PktWait
, A0
),
81 AROS_UFCA(struct MsgPort
*, msgPort
, A1
),
82 AROS_UFCA(struct ExecBase
*, SysBase
, A6
));
88 /* Make sure we have a packet -- we may be woken up even if there is
89 not a packet for us as SIGF_DOS may be used and we may have another
90 message port that waits for packets, too. */
91 while ((msg
= GetMsg(msgPort
)) == NULL
)
93 Wait(1 << msgPort
->mp_SigBit
);
97 D(bug("[DOS] WaitPkt(): got DOS packet 0x%p in message 0x%p\n", msg
->mn_Node
.ln_Name
, msg
));
98 return (struct DosPacket
*)msg
->mn_Node
.ln_Name
;