% Tests process creation, monitors, conditions and process switching.

const initialObject == object initialObject
  process
    const newobj == 
      object innerObject
	export Hi, Ho, Hum
	monitor
	  var flip : Integer <- 0
	  const c : Condition == Condition.create
	  
	  operation Hum
	  end Hum
	  
	  operation Hi
	    if flip = 0 then
	      wait c
	    end if
	    % print "hi"
	    flip <- 0
	    signal c
	  end hi
	  operation Ho
	    if flip != 0 then
	      wait c
	    end if
	    % print "ho"
	    flip <- 1
	    signal c
	  end ho
	end monitor
	process
	  loop
	    self.ho
	  end loop
	end process
      end innerObject

    loop
      newobj.hi
    end loop
  end process
end initialObject
