(* Release 3.10 *) (*-------------------------------------------------------------------------* * * * PROCESS.DEF - Modula-2 multi-processing * * * * COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * * All Rights Reserved * * * *--------------------------------------------------------------------------*) (*# call(o_a_copy => on, o_a_size => on, near_call=>off) *) (*# call(seg_name => PROCESS) *) (*# module(implementation=>off) *) DEFINITION MODULE Process; IMPORT CoreProc; CONST MaxProcess = CoreProc.MaxProcess; TYPE SIGNAL; PROCEDURE StartScheduler; (* start the time sliced scheduler *) PROCEDURE StopScheduler; (* stops the time sliced scheduler *) PROCEDURE StartProcess(P: PROC; N: CARDINAL; Pr: CARDINAL); (* Start a new process *) PROCEDURE StopProcess(); (* Stops current thread *) PROCEDURE SEND(s: SIGNAL); (* Send a signal *) PROCEDURE WAIT(s: SIGNAL); (* Wait for signal *) PROCEDURE Notify(s: SIGNAL); (* Causes a task waiting on signal s to be scheduled when possible, (e.g. at next time slice). If no-one is waiting on s then the call has NO effect. This call CANNOT cause reschedule, so may be used by an interrupt handler to safely notify another process of an events occurance. *) PROCEDURE Awaited(s: SIGNAL) : BOOLEAN; (* Returns if any process are waiting on signal *) PROCEDURE Init(VAR s: SIGNAL); (* Initialize a signal *) (*# save, call(c_conv=>on) *) PROCEDURE Delay(T: CARDINAL); (* delays for at least T timeslices *) (*# restore *) (*# save, call(reg_saved=>(ax,bx,cx,dx,di,si,ds,es,st1,st2)) *) PROCEDURE Lock; (* Critical region lock. Prevents the current process from being de-scheduled by timeslicing, until a call to Unlock. Calls to Lock may be nested. *) PROCEDURE Unlock; (*# restore *) (* Unlock procedure, always paired with a call to Lock. *) PROCEDURE Idler; END Process.