INTERFACE--------------------------------------------- garbage collector support ---ThreadF ; IMPORT FloatMode;
PROCEDURE SuspendOthers ();
Suspend all threads except the caller's
PROCEDURE ResumeOthers ();
Resume the threads suspended by SuspendOthers
PROCEDURE ProcessStacks (p: PROCEDURE (start, stop: ADDRESS));
Apply p to each thread stack, with [start..stop) being the limits of the stack. All other threads must be suspended. ProcessStacks exists solely for the garbage collector.
PROCEDURE ProcessEachStack (p: PROCEDURE (start, stop: ADDRESS));
Apply p to each thread stack, with [start..stop) being the limits of the stack. Each thread is suspended individually. ProcessEachStack exists solely for the garbage collector.
------------------------------------------------ floating point support ---
access to the saved floating point state for the current thread.
PROCEDURE GetMyFPState (reader: PROCEDURE(READONLY s: FloatMode.ThreadState)); PROCEDURE SetMyFPState (writer: PROCEDURE(VAR s: FloatMode.ThreadState));-------------------------------------------------- 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;-------------------------------------------------------------- identity ---
PROCEDURE MyId(): Id RAISES {};
return Id of caller
---------------------------------------------------- exception delivery ---
PROCEDURE GetCurrentHandlers(): ADDRESS;
== RETURN Upthread.getspecific(handlersIndex)
PROCEDURE SetCurrentHandlers(h: ADDRESS);
== Upthread.setspecific(handlersIndex, h)
PROCEDURE Init(); END ThreadF.