#include <sys/syscall.h>
#include <unistd.h>
#include <errno.h>
#include <pfunc/environ.hpp>
Go to the source code of this file.
Defines |
| #define | SYS_futex 202 |
| #define | FUTEX_WAIT 0 |
| #define | FUTEX_WAKE 1 |
Functions |
| static PFUNC_INLINE void | futex_wait (int *addr, int val) |
| | Atomically checks if the value at the given address is what is expected. If so, the the calling thread is put to sleep waiting on a futex_wake call to occur. If the value at the address has changed, the calling thread returns without entering the kernel.
|
| static PFUNC_INLINE void | futex_wake (int *addr, int nthreads) |
| | Wakes up the specified number of threads which are sleeping on using futex_wait at the given address.
|
| static PFUNC_INLINE void | cpu_relax (void) |
| | Performs a nop -- basically a way to ensure we are not using memory.
|
Define Documentation
Function Documentation
| static PFUNC_INLINE void cpu_relax |
( |
void |
| ) |
[static] |
Performs a nop -- basically a way to ensure we are not using memory.
| static PFUNC_INLINE void futex_wait |
( |
int * |
addr, |
|
|
int |
val |
|
) |
| [static] |
Atomically checks if the value at the given address is what is expected. If so, the the calling thread is put to sleep waiting on a futex_wake call to occur. If the value at the address has changed, the calling thread returns without entering the kernel.
- Parameters:
-
| [in] | addr | Address at which the value needs to be checked. |
| [in] | val | The value if found at the given address, the sleep should be entering. |
| static PFUNC_INLINE void futex_wake |
( |
int * |
addr, |
|
|
int |
nthreads |
|
) |
| [static] |
Wakes up the specified number of threads which are sleeping on using futex_wait at the given address.
- Parameters:
-
| [in] | addr | Address at which the threads are waiting. |
| [in] | nthreads | The number of threads to wake up. |