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

$Date$
 *
 * Glue for Host POSIX signaller use by PCR implementation.
 */

#ifndef ←←PCR←SigGlue←h
#define ←←PCR←SigGlue←h 1

#include <config/PCR←StdTypes.h>

/*
 * Enable / Disable host signals (call from critical section)
 */

extern PCR←Bool volatile PCR←SigGlue←hostSigsEnabled;
/*
    Readonly signal enabled state maintained by Enable / Disable Sigs below.
*/

extern void PCR←SigGlue←←EnableHostSigs();
extern void PCR←SigGlue←←DisableHostSigs();

#define PCR←SigGlue←EnableHostSigs() \
	if( !PCR←SigGlue←hostSigsEnabled ) PCR←SigGlue←←EnableHostSigs()

#define PCR←SigGlue←DisableHostSigs() \
	if( PCR←SigGlue←hostSigsEnabled ) PCR←SigGlue←←DisableHostSigs()

/*
 * Time
 */

extern PCR←Msec volatile PCR←SigGlue←msecSinceBoot;
extern PCR←Msec PCR←SigGlue←msecPerTick;
/*
    Readonly timing parameters of this system.
*/


PCR←Bool (* volatile PCR←SigGlue←tickProc)(void);
/*
    Called on each clock tick with host signals disabled.
    If it returns true, a thread switch is done as soon as possible.
    It is permissible for this proc to enable signals; it is
      not necessary for it to disable signals again before returning.
    It is permissible for this proc to do a thread switch, if not
      in a critical section.  It is better just to return true.
*/


/*
 * I/O
 */

PCR←Bool (* volatile PCR←SigGlue←ioDoneProc)(PCR←Bool urgent);
/*
    Handler for host I/O done signals (typically SIGIO, SIGURG).
    Not all host systems support these.
    If it returns true, a thread switch is done as soon as possible.
    It is permissible for this proc to enable signals; it is
      not necessary for it to disable signals again before returning.
    It is permissible for this proc to do a thread switch, if not
      in a critical section.  It is better just to return true.
*/

PCR←Msec PCR←SigGlue←ioPollMsec;
/*
    If nonzero, the ioDoneProc will be called this frequently
      (but at most once per tick) by the timer
      as well as in response to SIGIO etc.
*/


/*
 * Children
 */

PCR←Bool (* volatile PCR←SigGlue←childDoneProc)(void);
/*
    Handler for child done signals (SIGCHLD).
    Not all host systems support these.
    If it returns true, a thread switch is done as soon as possible.
    It is permissible for this proc to enable signals; it is
      not necessary for it to disable signals again before returning.
    It is permissible for this proc to do a thread switch, if not
      in a critical section.  It is better just to return true.
*/

PCR←Msec PCR←SigGlue←childPollMsec;
/*
    If nonzero, the childDoneProc will be called this frequently
      (but at most once per tick) by the timer
      as well as in response to SIGCHLD.
*/



/*
 * Memory protection
 */

PCR←Bool /* proceed */
(* volatile PCR←SigGlue←protFaultProc)(void * addr);
    /* ??? need other info here ??? */
/*
    Handler for memory protection faults.
    If the protFaultProc returns true, this is an assertion that the
      cause of the protection violation has been fixed, and the
      operation should be retried.
    If the protFaultProc returns false, it is unable to fix things,
      and the protection violation signal is delivered to the
      thread by the normal (POSIX signal emulation) mechanism.
    It is not permissible for this proc to enable signals.
    It is not permissible for this proc to do a thread switch.
    It is not permissible for this proc itself to write-fault.
*/


#endif /* !←←PCR←SigGlue←h */

/*
$Log$
*/