The manual
ginnOS
The reference: libc, the libraries and the kernel
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
16struct user_space;
17
18/**
19 * set up the queues. call once at boot, before the first futex call.
20 */
21void 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 */
30int futex_wake(struct user_space *space, uintptr_t uaddr, int count);
int futex_wake(struct user_space *space, uintptr_t uaddr, int count)
wake threads that sleep on a futex.
Definition futex.c:54
void futex_init(void)
set up the queues.
Definition futex.c:45
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
the user half of an address space: the page tables, the areas (vma.h) and the program break.
Definition user_space.h:16