Skip to content

vlc_atomic: make the vlc_atomic_XXX variables 32 bits atomics

Steve Lhomme requested to merge robUx4/vlc:futex-32bits-atomic into master

On Linux and FreeBSD the futex usage implies the variable is a 32 bits integer.

Linux:

A futex is a 32-bit value—referred to below as a futex word—whose address is
supplied to the futex() system call. (Futexes are 32 bits in size on all
platforms, including 64-bit systems.)

The uaddr argument points to the futex word. On all platforms, futexes are
four-byte integers that must be aligned on a four-byte boundary.

FreeBSD :

It uses UMTX_OP_WAIT_UINT_PRIVATE which is similar to UMTX_OP_WAIT_UINT.
UMTX_OP_WAIT_UINT is the same as UMTX_OP_WAIT but with "the type of the
variable pointed to by obj is u_int, i.e. 32-bit integer".

Either we use a type per platform, a common type (this patch) or allow more types on platforms that allow more types.

The type needs to be an atomic because the vlc_wait_XXX do some atomic operations on the variables before calling the "system" futeces.

atomic_uint_least32_t is allegedly 32-bits on most platforms so we use that as a strictly 32-bits atomic type.

Deprecates !691 (closed)

Edited by Steve Lhomme

Merge request reports

Loading