Package org.jcsp.lang

Class Spurious


  • class Spurious
    extends java.lang.Object
    This holds the static flag (indicating whether spurious wakeups should be logged) and early timeout allowance (for Alternatives with CSTimer guards).

    Description

    These fields are held in this separate class to minimise class loading when spurious wakeups are not logged - the default condition.
    See Also:
    SpuriousLog
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long earlyTimeout
      This is the allowed early timeout (in msecs).
      static boolean logging
      If logging is required, this flag should be set before any concurrency is started.
    • Constructor Summary

      Constructors 
      Constructor Description
      Spurious()  
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logging

        public static boolean logging
        If logging is required, this flag should be set before any concurrency is started. It should only be set once using SpuriousLog.start(). There is no concurrency protection!
      • earlyTimeout

        public static long earlyTimeout
        This is the allowed early timeout (in msecs). Some JVMs timeout on calls of wait (timeout) early - this specifies how early JCSP will tolerate.

        We need this to distinguish between a JVM-early timeout (that should be accepted) and a spurious wakeup (that should not). The value to which this field should be set is machine dependant. For JVMs that do not return early timeouts, it should be set to zero. For many, it should be left at the default value (4). If logging is enabled, counts of spurious wakeups versus accepted early timeouts on select operations on Alternatives can be obtained; this field should be set to minimise the former.

        This field should be set before any concurrency is started. It should only be set once using SpuriousLog.setEarlyTimeout(long). There is no concurrency protection!

    • Constructor Detail

      • Spurious

        Spurious()