exec.library: Use the new AROS_UFIx() macros
[AROS.git] / rom / exec / setexcept.c
blobfa8ff66fc7c0d9680478823a7171b6f29ce970a7
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Examine and/or modify the signals which cause an exception.
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH2(ULONG, SetExcept,
19 /* SYNOPSIS */
20 AROS_LHA(ULONG, newSignals, D0),
21 AROS_LHA(ULONG, signalSet, D1),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 52, Exec)
26 /* FUNCTION
27 Change the mask of signals causing a task exception.
29 INPUTS
30 newSignals - Set of signals causing the exception.
31 signalSet - Mask of affected signals.
33 RESULT
34 Old mask of signals causing a task exception.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 AllocSignal(), FreeSignal(), Wait(), SetSignal(), Signal()
45 INTERNALS
47 HISTORY
49 ******************************************************************************/
51 AROS_LIBFUNC_INIT
53 /* Get pointer to current task */
54 struct Task *me = FindTask(NULL);
55 ULONG old;
57 /* Protect mask of sent signals and task lists */
58 Disable();
60 /* Get returncode */
61 old=me->tc_SigExcept;
63 /* Change exception mask */
64 me->tc_SigExcept=(old&~signalSet)|(newSignals&signalSet);
66 /* Does this change include an exception? */
67 if (me->tc_SigExcept & me->tc_SigRecvd)
69 /* Yes. Set the exception flag. */
70 me->tc_Flags|=TF_EXCEPT;
72 /* And order rescheduling */
73 Reschedule();
75 Enable();
77 return old;
79 AROS_LIBFUNC_EXIT