show more relevant debug
[AROS.git] / rom / exec / setexcept.c
blob08cfd11b309f9131bcdf8dcb8bb7dd3ddd07036e
1 /*
2 Copyright © 1995-2017, 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 #define DEBUG 0
11 #include <exec/execbase.h>
12 #include <aros/libcall.h>
13 #include <proto/exec.h>
15 #include "exec_intern.h"
16 #if defined(__AROSEXEC_SMP__)
17 #include "etask.h"
18 #include "exec_locks.h"
19 #endif
21 /*****************************************************************************
23 NAME */
25 AROS_LH2(ULONG, SetExcept,
27 /* SYNOPSIS */
28 AROS_LHA(ULONG, newSignals, D0),
29 AROS_LHA(ULONG, signalSet, D1),
31 /* LOCATION */
32 struct ExecBase *, SysBase, 52, Exec)
34 /* FUNCTION
35 Change the mask of signals causing a task exception.
37 INPUTS
38 newSignals - Set of signals causing the exception.
39 signalSet - Mask of affected signals.
41 RESULT
42 Old mask of signals causing a task exception.
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 AllocSignal(), FreeSignal(), Wait(), SetSignal(), Signal()
53 INTERNALS
55 HISTORY
57 ******************************************************************************/
59 AROS_LIBFUNC_INIT
61 /* Get pointer to current task */
62 struct Task *thisTask = GET_THIS_TASK;
63 ULONG old;
65 /* Protect mask of sent signals and task lists */
66 Disable();
67 #if defined(__AROSEXEC_SMP__)
68 EXEC_LOCK_WRITE(&IntETask(thisTask->tc_UnionETask.tc_ETask)->iet_TaskLock);
69 #endif
71 /* Get returncode */
72 old = thisTask->tc_SigExcept;
74 /* Change exception mask */
75 thisTask->tc_SigExcept = (old & ~signalSet) | (newSignals & signalSet);
77 /* Does this change include an exception? */
78 if (thisTask->tc_SigExcept & thisTask->tc_SigRecvd)
80 /* Yes. Set the exception flag. */
81 thisTask->tc_Flags |= TF_EXCEPT;
83 /* And order rescheduling */
84 Reschedule();
86 #if defined(__AROSEXEC_SMP__)
87 EXEC_UNLOCK(&IntETask(thisTask->tc_UnionETask.tc_ETask)->iet_TaskLock);
88 #endif
89 Enable();
91 return old;
93 AROS_LIBFUNC_EXIT