Package org.jcsp.lang

Class Crew

    • Constructor Summary

      Constructors 
      Constructor Description
      Crew()
      Construct a lock for CREW-guarded operations on a shared resource.
      Crew​(Object shared)
      Construct a lock for CREW-guarded operations on a shared resource.
    • Constructor Detail

      • Crew

        public Crew()
        Construct a lock for CREW-guarded operations on a shared resource.
      • Crew

        public Crew​(Object shared)
        Construct a lock for CREW-guarded operations on a shared resource.
        Parameters:
        shared - the shared resource for which this lock is to be used (see getShared).
    • Method Detail

      • finalize

        protected void finalize()
                         throws Throwable
        Finalize method added to terminate the process that it spawned. The spawned process holds no references to this object so this object will eventually fall out of scope and gets finalized.
        Overrides:
        finalize in class Object
        Throws:
        Throwable
      • startRead

        public void startRead()
        This must be invoked before any read operations on the associated shared resource.
      • endRead

        public void endRead()
        This must be invoked after any read operations on the associated shared resource.
      • startWrite

        public void startWrite()
        This must be invoked before any write operations on the associated shared resource.
      • endWrite

        public void endWrite()
        This must be invoked after any write operations on the associated shared resource.
      • getShared

        public Object getShared()
        This returns the shared resource associated with this lock by its constructor. Note: if the parameterless constructor was used, this will return null.
        Returns:
        the shared resource associated with this lock.