Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / timer / abortio.c
blob346c3da39bb660ee36d9eda25d608509b472ef5f
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: AbortIO() - abort a running timer request.
6 Lang: english
7 */
8 #include "timer_intern.h"
9 #include <exec/io.h>
10 #include <exec/errors.h>
12 /*****i***********************************************************************
14 NAME */
15 #include <devices/timer.h>
16 #include <proto/exec.h>
17 #include <proto/timer.h>
19 AROS_LH1(LONG, AbortIO,
21 /* SYNOPSIS */
22 AROS_LHA(struct timerequest *, timereq, A1),
24 /* LOCATION */
25 struct TimerBase *, TimerBase, 6,Timer)
27 /* FUNCTION
28 Abort a running timer.device request.
30 INPUTS
31 timereq - The request you wish to abort.
33 RESULT
34 0 if the request was aborted, io_Error will also be set
35 to the value IOERR_ABORTED.
37 -1 otherwise (most likely that the request isn't working).
39 If the request is successfully aborted, you should WaitIO() on
40 the message before you try and reuse it.
42 NOTES
43 This function may be called from interrupts.
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 exec/AbortIO(), exec/WaitIO()
52 INTERNALS
54 HISTORY
55 18-02-1997 iaint Implemented.
57 ******************************************************************************/
59 AROS_LIBFUNC_INIT
61 LONG ret = -1;
64 As the timer.device runs as an interrupt, we had better protect
65 the "waiting timers" list from being corrupted.
68 Disable();
69 if(timereq->tr_node.io_Message.mn_Node.ln_Type != NT_REPLYMSG)
71 timereq->tr_node.io_Error = IOERR_ABORTED;
73 /* We have to fix up the following request if it exists.
74 What we do is add the time remaining for the first request
75 to the second request.
78 #if 0 /* stegerg: ??? */
79 tr = (struct timerequest *)timereq->tr_node.io_Message.mn_Node.ln_Succ;
80 if( tr && tr->tr_node.io_Message.mn_Node.ln_Succ != 0 )
82 tr->tr_time.tv_secs += timereq->tr_time.tv_secs;
83 tr->tr_time.tv_micro += timereq->tr_time.tv_micro;
85 #endif
88 XXX: If this is the first in the list, we have to resend
89 XXX the wait request. I can't do that from here yet.
92 if( timereq->tr_node.io_Message.mn_Node.ln_Pred == NULL )
95 Remove((struct Node *)timereq);
96 ReplyMsg((struct Message *)timereq);
97 ret = 0;
99 Enable();
102 return ret;
104 AROS_LIBFUNC_EXIT
105 } /* AbortIO */