thread/src/NOOP/ThreadF.i3


Copyright (C) 1994, Digital Equipment Corp.

INTERFACE ThreadF;

IMPORT FloatMode, Thread;
------------------------------------------------------ compiler support ---

<*EXTERNAL "_M3__bottom_of_stack"*> VAR bottom_of_stack: ADDRESS;
<*EXTERNAL "_M3__stack_grows_down"*>VAR stack_grows_down: INTEGER;
<*EXTERNAL "_M3__handlers"*>        VAR currentHandlers: ADDRESS;
<*EXTERNAL "_M3__stackLimit"*>      VAR currentStackLimit: ADDRESS;
these variables are read and written directly by compiler generated code. Changing their names, types or values is very dangerous.

--------------------------------------------- exception handling support --

PROCEDURE GetCurrentHandlers(): ADDRESS;
== RETURN currentHandlers

PROCEDURE SetCurrentHandlers(h: ADDRESS);
== currentHandlers := h
--------------------------------------------- garbage collector support ---

PROCEDURE ProcessStacks (p: PROCEDURE (start, stop: ADDRESS));
This procedure apply p to each stack, with start and stop being the limits of the stack. It is there mainly for the benefit of the garbage collector.
------------------------------------------------ floating point support ---

PROCEDURE MyFPState (): UNTRACED REF FloatMode.ThreadState;
returns the saved floating point state for the current thread. WARNING: the return value is an untraced pointer to a traced Thread.T!!
-------------------------------------------------- showthreads support ---

TYPE
  State = {
        alive    (* can run *),
        waiting  (* waiting for a condition via Wait *),
        locking  (* waiting for a mutex to be unlocked *),
        pausing  (* waiting until some time is arrived *),
        blocking (* waiting for some IO *),
        dying    (* done, but not yet joined *),
        dead     (* done and joined *)
	};

TYPE
  Id = INTEGER;
--------------------------------------------------------- hooks support ---

PRIVATE VAR hooks: Hooks := NIL

TYPE
  Hooks = OBJECT METHODS
    fork (t: Thread.T);  (* called with RT0u.inCritical > 0 *)
    die  (t: Thread.T);  (* called with RT0u.inCritical > 0 *)
  END;

PROCEDURE RegisterHooks (h: Hooks; init := TRUE): Hooks RAISES {};
return current hooks and set hooks := h. If init is true, call hooks.fork (t) for every thread t in the ring in a single critical section.

PROCEDURE MyId(): Id RAISES {};
return Id of caller

END ThreadF.

ThreadF's implementation is in:


interface FloatMode is in:


procedure ThreadF.GetCurrentHandlers is in:


procedure ThreadF.SetCurrentHandlers is in:


procedure ThreadF.ProcessStacks is in:


procedure ThreadF.MyFPState is in:


procedure ThreadF.RegisterHooks is in:


procedure ThreadF.MyId is in: