com.jogamp.common.util.locks

## Interface Lock

- All Known Subinterfaces:
    RecursiveLock, RecursiveThreadGroupLock, ThreadLock
  All Known Implementing Classes:
    SingletonInstance

      public interface Lock

  Specifying a thread blocking lock implementation

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEBUG` Enable via the property `jogamp.debug.Lock`
    `static long` | `DEFAULT_TIMEOUT` The default `TIMEOUT` value, of 5000L ms
    `static long` | `TIMEOUT` The `TIMEOUT` for `lock()` in ms, defaults to `DEFAULT_TIMEOUT`.
    `static boolean` | `TRACE_LOCK` Enable via the property `jogamp.debug.Lock.TraceLock`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isLocked()` Query if locked
    `void` | `lock()` Blocking until the lock is acquired by this Thread or `TIMEOUT` is reached.
    `boolean` | `tryLock(long timeout)` Blocking until the lock is acquired by this Thread or `maxwait` in ms is reached.
    `void` | `unlock()` Release the lock.

- - ### Field Detail

    - #### DEBUG

          static final boolean DEBUG

      Enable via the property `jogamp.debug.Lock`

    - #### TRACE_LOCK

          static final boolean TRACE_LOCK

      Enable via the property `jogamp.debug.Lock.TraceLock`

    - #### DEFAULT_TIMEOUT

          static final long DEFAULT_TIMEOUT

      The default `TIMEOUT` value, of 5000L ms
      See Also:
        Constant Field Values

    - #### TIMEOUT

          static final long TIMEOUT

      The `TIMEOUT` for `lock()` in ms, defaults to `DEFAULT_TIMEOUT`.

      It can be overridden via the system property `jogamp.common.utils.locks.Lock.timeout`.

  - ### Method Detail

    - #### lock

          void lock()
                    throws RuntimeException

      Blocking until the lock is acquired by this Thread or `TIMEOUT` is reached.
      Throws:
        `RuntimeException` - in case of `TIMEOUT`

    - #### tryLock

          boolean tryLock(long timeout)
                          throws InterruptedException

      Blocking until the lock is acquired by this Thread or `maxwait` in ms is reached.
      Parameters:
        `timeout` - Maximum time in ms to wait to acquire the lock. If this value is zero, the call returns immediately either without being able to acquire the lock, or with acquiring the lock directly while ignoring any scheduling order.
      Returns:
        true if the lock has been acquired within `maxwait`, otherwise false
      Throws:
        `InterruptedException`

    - #### unlock

          void unlock()
                      throws RuntimeException

      Release the lock.
      Throws:
        `RuntimeException` - in case the lock is not acquired by this thread.

    - #### isLocked

          boolean isLocked()

      Query if locked