2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: AbortIO() - abort a running timer request.
8 #include "timer_intern.h"
10 #include <exec/errors.h>
12 /*****i***********************************************************************
15 #include <devices/timer.h>
16 #include <proto/exec.h>
17 #include <proto/execlock.h>
18 #include <proto/timer.h>
20 AROS_LH1(LONG
, AbortIO
,
23 AROS_LHA(struct timerequest
*, timereq
, A1
),
26 struct TimerBase
*, TimerBase
, 6,Timer
)
29 Abort a running timer.device request.
32 timereq - The request you wish to abort.
35 0 if the request was aborted, io_Error will also be set
36 to the value IOERR_ABORTED.
38 -1 otherwise (most likely that the request isn't working).
40 If the request is successfully aborted, you should WaitIO() on
41 the message before you try and reuse it.
44 This function may be called from interrupts.
51 exec/AbortIO(), exec/WaitIO()
56 18-02-1997 iaint Implemented.
58 ******************************************************************************/
61 #if defined(__AROSEXEC_SMP__)
62 struct ExecLockBase
*ExecLockBase
= TimerBase
->tb_ExecLockBase
;
67 As the timer.device runs as an interrupt, we had better protect
68 the "waiting timers" list from being corrupted.
72 #if defined(__AROSEXEC_SMP__)
73 if (ExecLockBase
) ObtainLock(TimerBase
->tb_ListLock
, SPINLOCK_MODE_WRITE
, 0);
75 if(timereq
->tr_node
.io_Message
.mn_Node
.ln_Type
!= NT_REPLYMSG
)
77 Remove((struct Node
*)timereq
);
79 timereq
->tr_node
.io_Error
= IOERR_ABORTED
;
80 timereq
->tr_time
.tv_secs
= 0;
81 timereq
->tr_time
.tv_micro
= 0;
83 if (!(timereq
->tr_node
.io_Flags
& IOF_QUICK
))
84 ReplyMsg((struct Message
*)timereq
);
87 #if defined(__AROSEXEC_SMP__)
88 if (ExecLockBase
) ReleaseLock(TimerBase
->tb_ListLock
, 0);