gm2-libs-iso/RTco (The GNU Modula-2 Compiler)

#### 4.4.32 gm2-libs-iso/RTco ¶

    DEFINITION MODULE FOR "C" RTco ;

    FROM SYSTEM IMPORT ADDRESS ;

    IMPORT RTentity ;  (* Imported so the initialization call graph
                          understands that RTco.cc depends upon RTentity.  *)

    (* init initializes the module and allows the application to lazily invoke threads.  *)

    PROCEDURE init () : INTEGER ;

    PROCEDURE initThread (p: PROC; stackSize: CARDINAL; interruptLevel: CARDINAL) : INTEGER ;

    PROCEDURE initSemaphore (value: CARDINAL) : INTEGER ;

    PROCEDURE wait (semaphore: INTEGER) ;

    PROCEDURE signal (semaphore: INTEGER) ;

    PROCEDURE transfer (VAR p1: INTEGER; p2: INTEGER) ;

    PROCEDURE waitThread (tid: INTEGER) ;

    PROCEDURE signalThread (tid: INTEGER) ;

    PROCEDURE currentThread () : INTEGER ;

    (* currentInterruptLevel returns the interrupt level of the current thread.  *)

    PROCEDURE currentInterruptLevel () : CARDINAL ;

    (* turninterrupts returns the old interrupt level and assigns the interrupt level
       to newLevel.  *)

    PROCEDURE turnInterrupts (newLevel: CARDINAL) : CARDINAL ;

    (*
       select access to the select system call which will be thread safe.
       This is typically called from the idle process to wait for an interrupt.
    *)

    PROCEDURE select (p1: INTEGER;
                      p2: ADDRESS;
                      p3: ADDRESS;
                      p4: ADDRESS;
                      p5: ADDRESS) : INTEGER ;

    END RTco.