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

$Date$
 *
 * PCR threads glue
 */

#ifndef ←←PCR←ThGlue←h
#define ←←PCR←ThGlue←h 1

#include <config/PCR←StdTypes.h>
#include <th/PCR←ThTypes.h>

/*
 * The following boolean variables may be set externally to cause the
 *   thread switcher to call the associated proc on the next thread
 *   switch ...
 *     - the argument is always NIL,
 *     - all procs are called in sys critical sections,
 *     - the procs may do (sticky) notifies, but may *not* block.
 *        ( ?? June 28, 1992 ajd ?? )
 * Client need not initialize the proc var before the associated boolean
 *   var is set; if NIL it will not be called.
 * The proc should be prepared to be called even if the variable is not set.
 * It is the proc's responsibility to clear the variable.
 * The intended uses are described with the procs.
 */

PCR←Bool volatile PCR←ThGlue←doCheckIO;
void (* volatile PCR←ThGlue←checkIO)(PCR←Any);
/*
    A host file descriptor may have become ready for a requested I/O op.
*/

PCR←Bool volatile PCR←ThGlue←doCheckTimeout;
void (* volatile PCR←ThGlue←checkTimeout)(PCR←Any);
/*
    A clock tick occurred and could not be processed immediately
*/

PCR←Bool volatile PCR←ThGlue←doCheckChildren;
void (* volatile PCR←ThGlue←checkChildren)(PCR←Any);
/*
    SIGCHLD handling.
*/

PCR←Bool volatile PCR←ThGlue←doCollectSigs;
void (* volatile PCR←ThGlue←collectSigs)(PCR←sigset←t * sigs);
/*
    A host signal has arrived.
    The switcher calls collectSigs(s) to set *s to the set of
      traps that have arrived since the last call to collectSigs.
    External POSIX signals are handled by this mechanism without
      being returned here; see PCR←Sig←GetExternalInterrupts().
    This mechanism delivers a trap to client code "immediately",
      *unless* the trap occurs in a critical section.  Well, client
      code isn't supposed to be using critical sections, and
      the PCR implementation isn't supposed to generate traps,
      it says here ...
    The signal set is a PCR←sigset←t, *not* a host sigset←t -- i.e.,
      signal numbers have already been translated.
*/


/*
 * Determine action associated with given signal
 */

void (* volatile PCR←ThGlue←getSigAction)(
        int sig, /* result */ PCR←Sig←Action * sa );

/*
 * The following is maintained by exclusive running threads
 */

PCR←Bool volatile PCR←ThGlue←runExclusive;
PCR←Bool (* volatile PCR←ThGlue←checkRunExclusive)(PCR←Th←T *t);
/*
    Return true iff t is allowed to run.
*/

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