2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
10 #include <proto/dos.h>
11 #include <proto/exec.h>
12 #include "dos_intern.h"
13 #include <devices/timer.h>
16 /*****************************************************************************
19 #include <proto/dos.h>
24 AROS_LHA(ULONG
, timeout
, D1
),
27 struct DosLibrary
*, DOSBase
, 33, Dos
)
30 Waits for at least the time specified as timeout.
33 timeout - the minimum time to wait in ticks (1/50 seconds)
47 *****************************************************************************/
51 struct timerequest timerio
;
52 struct MsgPort timermp
;
54 memset(&timermp
, 0, sizeof(timermp
));
56 timermp
.mp_Node
.ln_Type
= NT_MSGPORT
;
57 timermp
.mp_Flags
= PA_SIGNAL
;
58 timermp
.mp_SigBit
= SIGB_SINGLE
;
59 timermp
.mp_SigTask
= FindTask(NULL
);
60 NEWLIST(&timermp
.mp_MsgList
);
62 /* clone timerequest in DOSBase */
63 timerio
= DOSBase
->dl_TimerIO
;
65 timerio
.tr_node
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
66 timerio
.tr_node
.io_Message
.mn_ReplyPort
= &timermp
;
67 timerio
.tr_node
.io_Command
= TR_ADDREQUEST
;
68 timerio
.tr_time
.tv_secs
= timeout
/ TICKS_PER_SECOND
;
69 timerio
.tr_time
.tv_micro
= 1000000UL / TICKS_PER_SECOND
* (timeout
% TICKS_PER_SECOND
);
71 SetSignal(0, SIGF_SINGLE
);
73 DosDoIO(&timerio
.tr_node
);