MOS Source Code
Loading...
Searching...
No Matches
wait.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include "mos/mm/slab.h"
6
9#include <mos/mos_global.h>
10
19
20typedef struct
21{
22 bool closed; // if true, then the process is closed and should not be waited on
23 spinlock_t lock; // protects the waiters list
24 list_head list; // list of threads waiting
26
27extern slab_t *waitlist_slab;
28
30
31void waitlist_init(waitlist_t *list);
33size_t waitlist_wake(waitlist_t *list, size_t max_wakeups);
34void waitlist_close(waitlist_t *list);
35void waitlist_remove_me(waitlist_t *waitlist);
36
38
39#define waitlist_wake_one(list) waitlist_wake(list, 1)
40#define waitlist_wake_all(list) waitlist_wake(list, SIZE_MAX)
list_node_t list_head
A linked list head.
Definition list.h:23
#define __END_DECLS
Definition mos_global.h:23
#define __nodiscard
Definition mos_global.h:35
#define __BEGIN_DECLS
Definition mos_global.h:22
Definition slab.h:45
The entry in the waiters list of a process, or a thread.
Definition wait.h:15
tid_t waiter
Definition wait.h:17
as_linked_list
Definition wait.h:16
bool closed
Definition wait.h:22
spinlock_t lock
Definition wait.h:23
list_head list
Definition wait.h:24
s32 tid_t
Definition types.h:79
size_t waitlist_wake(waitlist_t *list, size_t max_wakeups)
Definition wait.c:45
__BEGIN_DECLS void waitlist_init(waitlist_t *list)
Definition wait.c:23
slab_t * waitlist_slab
Definition wait.c:17
void waitlist_remove_me(waitlist_t *waitlist)
Definition wait.c:86
void waitlist_close(waitlist_t *list)
Definition wait.c:76
__nodiscard bool waitlist_append(waitlist_t *list)
Definition wait.c:29