next up previous
Next: basicprocessevent Up: simioprocess Previous: semaphore

Monitor


     NAME
	  monitor - relaxed P.B. Hansen	kind, for synchronization

     DESCRIPTION
	  Monitors are used to implement critical regions as an
	  object. Only one IOProcess is	allowed	to access the
	  internals of he Monitor at the same time. In this version of
	  monitors several IOProcess can be started at the same	time
	  (or just one). The string process is allowed to finish
	  before the started IOProcess(s) are allowed to enter the
	  Monitor.

     EXAMPLES
	  See the users	manual in simioprocess.ps

     AUTHOR
	  Boris	Magnusson, Lund	Institute of Technology.

     DETAILED INTERFACE
	     PriorityQ class Monitor(PMG);
	     ref(ProcessManager) PMG;
	  This class is	 an  implementation  of	 (almost)  traditional
	  monitors.    Monitors	 are  used  to	synchronize  processes
	  operating on shared data by means of the Monitor operations.
	  Only one IOProcess is	allowed	to execute a Mointor operation
	  at the time.	Supply a reference to  the  ProcessManager  as
	  parameter.

	   Supers: PriorityQ, SortedPool, Simset
	   Kind: Instantable
	   Init: PMG must reference the	SingleObject ProcessManager.
	   Sequencing in Mointor operations (where c  is  a  Condition
	  object):
	   : EnterMonitor
	   :   (c.Await/c.CauseOne/c.CauseAll)*
	   : ExitMonitor

     REQUIERED OPERATIONS TO CALL FROM ACCESSABLE
     EnterMonitor
	     procedure EnterMonitor;
	  Must be called at the	entry of each monitor operation.

     ExitMonitor
	     procedure ExitMonitor;
	  Must be called at the	exit of	each monitor operation.

     LOCAL NESTED CLASS
     Condition
	     class Condition;
	  This class is	local to the Monitor. Create  object  of  this
	  class	to represent conditions	(to wait for) in the monitor.

	   Sequencing: (Await /	CauseOne / CauseAll)*;

     OPERATIONS	ON CONDITIONS
     Await
		procedure Await;
	     Await the conditon	to be fullfiled.

     CauseOne
		procedure CauseOne;
	     The condition  is	true,  start  (at  most)  one  waiting
	     process.

     CauseAll
		procedure CauseAll;
	     The condition is true for all waiting processes  -	 Start
	     them all.