Class Futex

java.lang.Object
org.qbicc.runtime.linux.Futex

public class Futex extends Object
Support for futex(2) on Linux. See the manpage for more information.
  • Field Details

    • FUTEX_PRIVATE_FLAG

      public static final CNative.c_int FUTEX_PRIVATE_FLAG
    • FUTEX_CLOCK_REALTIME

      public static final CNative.c_int FUTEX_CLOCK_REALTIME
    • FUTEX_WAIT

      public static final CNative.c_int FUTEX_WAIT
    • FUTEX_WAIT_BITSET

      public static final CNative.c_int FUTEX_WAIT_BITSET
    • FUTEX_WAKE

      public static final CNative.c_int FUTEX_WAKE
    • FUTEX_BITSET_MATCH_ANY

      public static final Stdint.uint32_t FUTEX_BITSET_MATCH_ANY
  • Constructor Details

    • Futex

      public Futex()
  • Method Details

    • futex_wait

      public static boolean futex_wait(Stdint.uint32_t_ptr uaddr, Stdint.uint32_t val, Time.const_struct_timespec_ptr timeout)
      Wait until the value at given address is equal to val. Returns when woken (may be spurious). Spurious wakeups may return false and set errno to EAGAIN, or may return true. If the value at the test memory location already does not equal val, a wakeup will result.
      Parameters:
      uaddr - the address of the memory to test
      val - the value to observe
      timeout - the relative amount of time to wait
      Returns:
      true on success, or false on error (in errno)
    • futex_wait_absolute

      public static boolean futex_wait_absolute(Stdint.uint32_t_ptr uaddr, Stdint.uint32_t val, Time.const_struct_timespec_ptr timeout)
      Wait until the value at given address is equal to val. Returns when woken (may be spurious). Spurious wakeups may return false and set errno to EAGAIN, or may return true. If the value at the test memory location already does not equal val, a wakeup will result.
      Parameters:
      uaddr - the address of the memory to test
      val - the value to observe
      timeout - the absolute time to wake up
      Returns:
      true on success, or false on error (in errno)
    • futex_wake_single

      public static boolean futex_wake_single(Stdint.uint32_t_ptr uaddr)
      Wake a single waiter after updating the wait value.
      Parameters:
      uaddr - the address of the memory being waited on
      Returns:
      true on success, or false on error (in errno)
    • futex_wake_all

      public static boolean futex_wake_all(Stdint.uint32_t_ptr uaddr)
      Wake all waiters after updating the wait value.
      Parameters:
      uaddr - the address of the memory being waited on
      Returns:
      true on success, or false on error (in errno)