The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
futex.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* futex: a wait on a word in user memory. a thread sleeps while the word
5
* has the value it expects (FUTEX_WAIT), and another thread wakes it
6
* (FUTEX_WAKE) after it changes the word. libc builds its mutexes and
7
* condition variables on this, and pthread_join on the CLEARTID wake.
8
*
9
* a futex is known by its address space and its user address, so only
10
* the threads of one process share a futex (FUTEX_PRIVATE_FLAG on
11
* Linux). there is no futex between processes in shared memory yet.
12
*/
13
14
#include "
common/stdint.h
"
15
16
struct
user_space
;
17
18
/**
19
* set up the queues. call once at boot, before the first futex call.
20
*/
21
void
futex_init
(
void
);
22
23
/**
24
* wake threads that sleep on a futex.
25
* @param space the address space of the futex.
26
* @param uaddr its user address.
27
* @param count the most threads to wake.
28
* @return the number of threads woken.
29
*/
30
int
futex_wake
(
struct
user_space
*space,
uintptr_t
uaddr,
int
count);
stdint.h
futex_wake
int futex_wake(struct user_space *space, uintptr_t uaddr, int count)
wake threads that sleep on a futex.
Definition
futex.c:54
futex_init
void futex_init(void)
set up the queues.
Definition
futex.c:45
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:19
user_space
the user half of an address space: the page tables, the areas (vma.h) and the program break.
Definition
user_space.h:16
src
kernel
sync
futex.h
Generated by
1.18.0