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
7
#include <
mos/lib/structures/list.h
>
8
#include <
mos/lib/sync/spinlock.h
>
9
#include <
mos/mos_global.h
>
10
14
typedef
struct
15
{
16
as_linked_list
;
17
tid_t
waiter
;
18
}
waitable_list_entry_t
;
19
20
typedef
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
25
}
waitlist_t
;
26
27
extern
slab_t
*
waitlist_slab
;
28
29
__BEGIN_DECLS
30
31
void
waitlist_init
(
waitlist_t
*list);
32
__nodiscard
bool
waitlist_append
(
waitlist_t
*list);
33
size_t
waitlist_wake
(
waitlist_t
*list,
size_t
max_wakeups);
34
void
waitlist_close
(
waitlist_t
*list);
35
void
waitlist_remove_me
(
waitlist_t
*waitlist);
36
37
__END_DECLS
38
39
#define waitlist_wake_one(list) waitlist_wake(list, 1)
40
#define waitlist_wake_all(list) waitlist_wake(list, SIZE_MAX)
list_head
list_node_t list_head
A linked list head.
Definition
list.h:23
list.h
mos_global.h
__END_DECLS
#define __END_DECLS
Definition
mos_global.h:23
__nodiscard
#define __nodiscard
Definition
mos_global.h:35
__BEGIN_DECLS
#define __BEGIN_DECLS
Definition
mos_global.h:22
slab.h
spinlock.h
slab_t
Definition
slab.h:45
spinlock_t
Definition
spinlock.h:13
waitable_list_entry_t
The entry in the waiters list of a process, or a thread.
Definition
wait.h:15
waitable_list_entry_t::waiter
tid_t waiter
Definition
wait.h:17
waitable_list_entry_t::as_linked_list
as_linked_list
Definition
wait.h:16
waitlist_t
Definition
wait.h:21
waitlist_t::closed
bool closed
Definition
wait.h:22
waitlist_t::lock
spinlock_t lock
Definition
wait.h:23
waitlist_t::list
list_head list
Definition
wait.h:24
tid_t
s32 tid_t
Definition
types.h:79
waitlist_wake
size_t waitlist_wake(waitlist_t *list, size_t max_wakeups)
Definition
wait.c:45
waitlist_init
__BEGIN_DECLS void waitlist_init(waitlist_t *list)
Definition
wait.c:23
waitlist_slab
slab_t * waitlist_slab
Definition
wait.c:17
waitlist_remove_me
void waitlist_remove_me(waitlist_t *waitlist)
Definition
wait.c:86
waitlist_close
void waitlist_close(waitlist_t *list)
Definition
wait.c:76
waitlist_append
__nodiscard bool waitlist_append(waitlist_t *list)
Definition
wait.c:29
kernel
include
private
mos
tasks
wait.h
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0