Fixed a warning (missing type cast)
[tangerine.git] / rom / exec / setexcept.c
blobb9902169ca9d3d9c0ec7280edd3738fdb77caaa5
1 /*
2 Copyright © 1995-2001, 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 */
8 #include <exec/execbase.h>
9 #include <aros/libcall.h>
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
16 AROS_LH2(ULONG, SetExcept,
18 /* SYNOPSIS */
19 AROS_LHA(ULONG, newSignals, D0),
20 AROS_LHA(ULONG, signalSet, D1),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 52, Exec)
25 /* FUNCTION
26 Change the mask of signals causing a task exception.
28 INPUTS
29 newSignals - Set of signals causing the exception.
30 signalSet - Mask of affected signals.
32 RESULT
33 Old mask of signals causing a task exception.
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 AllocSignal(), FreeSignal(), Wait(), SetSignal(), Signal()
44 INTERNALS
46 ******************************************************************************/
48 AROS_LIBFUNC_INIT
50 struct Task *me;
51 ULONG old;
53 /* Get pointer to current task */
54 me=SysBase->ThisTask;
56 /* Protect mask of sent signals and task lists */
57 Disable();
59 /* Get returncode */
60 old=me->tc_SigExcept;
62 /* Change exception mask */
63 me->tc_SigExcept=(old&~signalSet)|(newSignals&signalSet);
65 /* Does this change include an exception? */
66 if(me->tc_SigExcept&me->tc_SigRecvd)
68 /* Yes. Set the exception flag. */
69 me->tc_Flags|=TF_EXCEPT;
71 /* Are taskswitches allowed? (Don't count own Disable() here) */
72 if(SysBase->TDNestCnt>=0||SysBase->IDNestCnt>0)
73 /* No. Store it for later. */
74 SysBase->AttnResched|=0x80;
75 else
76 /* Switches are allowed. Force a rescedule. */
77 Switch();
79 Enable();
81 return old;
82 AROS_LIBFUNC_EXIT
83 } /* SetExcept() */