RTEMS 6.1-rc2
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
futex.c File Reference

This source file contains the implementation of _Futex_Wait() and _Futex_Wake(). More...

#include <sys/lock.h>
#include <errno.h>
#include <rtems/score/atomic.h>
#include <rtems/score/chainimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>

Data Structures

struct  Futex_Control
 
struct  Futex_Context
 

Macros

#define FUTEX_TQ_OPERATIONS   &_Thread_queue_Operations_FIFO
 

Functions

 RTEMS_STATIC_ASSERT (offsetof(Futex_Control, Queue)==offsetof(struct _Futex_Control, _Queue), FUTEX_CONTROL_QUEUE)
 
 RTEMS_STATIC_ASSERT (sizeof(Futex_Control)==sizeof(struct _Futex_Control), FUTEX_CONTROL_SIZE)
 
int _Futex_Wait (struct _Futex_Control *_futex, int *uaddr, int val)
 Performs the FUTEX_WAIT operation.
 
int _Futex_Wake (struct _Futex_Control *_futex, int count)
 Performs the FUTEX_WAKE operation.
 

Detailed Description

This source file contains the implementation of _Futex_Wait() and _Futex_Wake().

Function Documentation

◆ _Futex_Wait()

int _Futex_Wait ( struct _Futex_Control *  _futex,
int *  uaddr,
int  val 
)

Performs the FUTEX_WAIT operation.

Parameters
[in,out]_futexis the futex object.
[in]uaddris the address to the futex state.
valis the expected futex state value.
Return values
0Returns zero if the futex state is equal to the expected value. In this case the calling thread is enqueued on the thread queue of the futex object.
EAGAINReturns EAGAIN if the futex state is not equal to the expected value.

◆ _Futex_Wake()

int _Futex_Wake ( struct _Futex_Control *  _futex,
int  count 
)

Performs the FUTEX_WAKE operation.

Parameters
[in,out]_futexis the futex object.
countis the maximum count of threads to wake up.
Returns
Returns the count of woken up threads.