home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / setexcept.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  2.3 KB  |  107 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: setexcept.c,v 1.7 1997/01/01 03:46:16 ldp Exp $
  4.     $Log: setexcept.c,v $
  5.     Revision 1.7  1997/01/01 03:46:16  ldp
  6.     Committed Amiga native (support) code
  7.  
  8.     Changed clib to proto
  9.  
  10.     Revision 1.6  1996/12/10 13:51:54  aros
  11.     Moved all #include's in the first column so makedepend can see it.
  12.  
  13.     Revision 1.5  1996/10/24 15:50:57  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.4  1996/08/13 13:56:08  digulla
  17.     Replaced AROS_LA by AROS_LHA
  18.     Replaced some AROS_LH*I by AROS_LH*
  19.     Sorted and added includes
  20.  
  21.     Revision 1.3  1996/08/01 17:41:19  digulla
  22.     Added standard header for all files
  23.  
  24.     Desc:
  25.     Lang:
  26. */
  27. #include <exec/execbase.h>
  28. #include <aros/libcall.h>
  29. #include <proto/exec.h>
  30.  
  31. /*****************************************************************************
  32.  
  33.     NAME */
  34.  
  35.     AROS_LH2(ULONG, SetExcept,
  36.  
  37. /*  SYNOPSIS */
  38.     AROS_LHA(ULONG, newSignals, D0),
  39.     AROS_LHA(ULONG, signalSet,  D1),
  40.  
  41. /*  LOCATION */
  42.     struct ExecBase *, SysBase, 52, Exec)
  43.  
  44. /*  FUNCTION
  45.     Change the mask of signals causing a task exception.
  46.  
  47.     INPUTS
  48.     newSignals - Set of signals causing the exception.
  49.     signalSet  - Mask of affected signals.
  50.  
  51.     RESULT
  52.     Old mask of signals causing a task exception.
  53.  
  54.     NOTES
  55.  
  56.     EXAMPLE
  57.  
  58.     BUGS
  59.  
  60.     SEE ALSO
  61.     AllocSignal(), FreeSignal(), Wait(), SetSignal(), Signal()
  62.  
  63.     INTERNALS
  64.  
  65.     HISTORY
  66.  
  67. ******************************************************************************/
  68. {
  69.     AROS_LIBFUNC_INIT
  70.  
  71.     struct Task *me;
  72.     ULONG old;
  73.  
  74.     /* Get pointer to current task */
  75.     me=SysBase->ThisTask;
  76.  
  77.     /* Protect mask of sent signals and task lists */
  78.     Disable();
  79.  
  80.     /* Get returncode */
  81.     old=me->tc_SigExcept;
  82.  
  83.     /* Change exception mask */
  84.     me->tc_SigExcept=(old&~signalSet)|(newSignals&signalSet);
  85.  
  86.     /* Does this change include an exception? */
  87.     if(me->tc_SigExcept&me->tc_SigRecvd)
  88.     {
  89.     /* Yes. Set the exception flag. */
  90.     me->tc_Flags|=TF_EXCEPT;
  91.  
  92.     /* Are taskswitches allowed? (Don't count own Disable() here) */
  93.     if(SysBase->TDNestCnt>=0||SysBase->IDNestCnt>0)
  94.         /* No. Store it for later. */
  95.         SysBase->AttnResched|=0x80;
  96.     else
  97.         /* Switches are allowed. Force a rescedule. */
  98.         Switch();
  99.     }
  100.     Enable();
  101.  
  102.     return old;
  103.     AROS_LIBFUNC_EXIT
  104. }
  105.  
  106.  
  107.