[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'Linux' (#rtl)

futex

Perform a futex operation

Declaration

Source position: linux.pp line 108

function futex(

  uaddr: pcint;

  op: cint;

  val: cint;

  timeout: ptimespec;

  addr2: pcint;

  val3: cint

):cint;

function futex(

  var uaddr;

  op: cint;

  val: cint;

  timeout: ptimespec;

  var addr2;

  val3: cint

):cint;

function futex(

  var uaddr;

  op: cint;

  val: cint;

  var timeout: TTimeSpec;

  var addr2;

  val3: cint

):cint;

function futex(

  uaddr: pcint;

  op: cint;

  val: cint;

  timeout: ptimespec

):cint;

function futex(

  var uaddr;

  op: cint;

  val: cint;

  timeout: ptimespec

):cint;

function futex(

  var uaddr;

  op: cint;

  val: cint;

  var timeout: TTimeSpec

):cint;

Description

futex performs an operation on a memory futex as described in the kernel manual page for futex. The mutex is located at uaddr, the operation op is one of the following constants:

FUTEX_WAIT
Futex option: Wait on futex till wake call arrives.
FUTEX_WAKE
Futex option: Wait on futex till wake call arrives.
FUTEX_FD
Futex option: Associate file descriptor with futex.
FUTEX_REQUEUE
Futex option: requeue waiting processes on other futex.
FUTEX_CMP_REQUEUE
Futex option: requeue waiting processes on other futex, but check it's value first

The value to check for is indicated in val, and a timeout can be specified in timeout. The optional arguments addr2 and val3 are used only with the FUTEX_REQUEUE and FUTEX_CMP_REQUEUE operations.

In case of an error, -1 is return. All other return values must be interpreted according to the operation performed.

This call directly interfaces with the Linux kernel, more information can be found in the kernel manual pages.

Errors

On error, -1 is returned. Use #rtl.baseunix.fpgeterrno to get the error code.


Documentation generated on: Nov 16 2015