/*
Copyright (c) 1993 Xerox Corporation.  All rights reserved.
*/
/*
$Id$

$Date$
 *
 * PCR sigs
 */

#ifndef ←←PCR←Sig←h
#define ←←PCR←Sig←h 1

#include <config/PCR←StdTypes.h>
#include <config/PCR←OS.h>
#include <sig/PCR←SigTypes.h>

/*
 *
 * TODO: Fix this comment ???
 * Unix/POSIX signals fall into two classes:
 *
 *   - asynchronous signals, or "interrupts".
 *   - synchronous signals, or "traps".
 *
 * In addition, every signal
 *
 *   - is either resumable or not.
 *   - has a default action.
 *
 * A trap is delivered to the thread that caused it.
 * An externally-generated interrupt (sent from another POSIX
 *   process using kill(2)) is simply recorded; it is available
 *   to any thread calling PCR←Sig←GetExternalInterrupts().
 * The procedure PCR←Th←T←SendSigs (in th/PCR←Th.h) can be used to
 *   deliver signals to individual threads.
 * Unlike POSIX, PCR allows any signal or (resumable) trap to be ignored
 *   or blocked.  This feature is admittedly dangerous.  The POSIX
 *   signal handling emulation enforces the standard semantics.
 * The meaning of SIG←DFL is as in POSIX (or the host OS, for non-POSIX
 *   signals).
 */

/*
 * Signal Ops
 */

#undef PCR←sigset←t←Add
extern int PCR←sigset←t←Add(PCR←sigset←t *mask, int signo);
#define PCR←sigset←t←Add PCR←sigset←t←←Add

#undef PCR←sigset←t←Del
extern int PCR←sigset←t←Del(PCR←sigset←t *mask, int signo);
#define PCR←sigset←t←Del PCR←sigset←t←←Del

#undef PCR←sigset←t←SetEmpty
extern int PCR←sigset←t←SetEmpty(PCR←sigset←t *mask);
#define PCR←sigset←t←SetEmpty PCR←sigset←t←←SetEmpty

#undef PCR←sigset←t←SetFull
extern int PCR←sigset←t←SetFull(PCR←sigset←t *mask);
#define PCR←sigset←t←SetFull PCR←sigset←t←←SetFull

#undef PCR←sigset←t←IsMember
extern int PCR←sigset←t←IsMember(PCR←sigset←t *mask, int signo);
#define PCR←sigset←t←IsMember PCR←sigset←t←←IsMember


/*
 * Useful signal sets
 */

extern const PCR←sigset←t PCR←sigset←t←readonlyFull;
extern const PCR←sigset←t PCR←sigset←t←readonlyEmpty;

extern /* const */ PCR←sigset←t PCR←Sig←sigsTrap;
extern /* const */ PCR←sigset←t PCR←Sig←sigsInt;
extern /* const */ PCR←sigset←t PCR←Sig←sigsResumable;
extern /* const */ PCR←sigset←t PCR←Sig←sigsNotCatchable;
extern /* const */ PCR←sigset←t PCR←Sig←sigsDefaultExit;
extern /* const */ PCR←sigset←t PCR←Sig←sigsDefaultIgnore;
extern /* const */ PCR←sigset←t PCR←Sig←sigsDefaultPause;
extern /* const */ PCR←sigset←t PCR←Sig←sigsDefaultContinue;


/*
 * PCR signal handling
 */


extern PCR←Sig←Handler * const PCR←Sig←Handler←default;
extern PCR←Sig←Handler * const PCR←Sig←Handler←ignore;


/*
 * Externally Generated Signals (from another POSIX process).
 */

extern PCR←ERes
PCR←Sig←GetExternalInterrupts(
    PCR←sigset←t *newInterruptsRecvd,
    const PCR←sigset←t *sigMask,
    PCR←Msec wakeup
);
/*
    Block until a new interrupt may have been received by the ppcr process;
      then atomically copy all received interrupts into *newInterruptsRecvd
      and clear the pending interrupts.
*/


#endif /* !←←PCR←Sig←h */
/*
$Log$
*/