Sign in Join
FPDoc Onlineexperiment

futex function

In unit Linux

Perform a futex operation.

Declaration

pascal
function futex(uaddr: pcint; op: cint; val: cint; timeout: ptimespec; 
 addr2: pcint; val3: cint): 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 fpgeterrno to get the error code.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.