Package org.jcsp.lang

Class Crew

    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void endRead()
      This must be invoked after any read operations on the associated shared resource.
      void endWrite()
      This must be invoked after any write operations on the associated shared resource.
      protected void finalize()
      Finalize method added to terminate the process that it spawned.
      java.lang.Object getShared()
      This returns the shared resource associated with this lock by its constructor.
      void startRead()
      This must be invoked before any read operations on the associated shared resource.
      void startWrite()
      This must be invoked before any write operations on the associated shared resource.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Crew

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

        public Crew​(java.lang.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 java.lang.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 java.lang.Object
        Throws:
        java.lang.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 java.lang.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.