Package org.jcsp.lang

Class Spurious

java.lang.Object
org.jcsp.lang.Spurious

class Spurious extends 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:
  • Field Details

    • 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 Details

    • Spurious

      Spurious()