MOS Source Code
Loading...
Searching...
No Matches
wait.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#pragma once
4
5
#include <
mos/allocator.hpp
>
6
#include <
mos/lib/structures/list.hpp
>
7
#include <
mos/lib/sync/spinlock.hpp
>
8
#include <
mos/mos_global.h
>
9
13
struct
waitable_list_entry_t
:
mos::NamedType
<"WaitlistEntry">
14
{
15
as_linked_list
;
16
tid_t
waiter
;
17
};
18
19
struct
waitlist_t
:
mos::NamedType
<"Waitlist">
20
{
21
bool
closed
;
// if true, then the process is closed and should not be waited on
22
spinlock_t
lock
;
// protects the waiters list
23
list_head
list
;
// list of threads waiting
24
waitlist_t
();
25
};
26
27
void
waitlist_init
(
waitlist_t
*list);
28
__nodiscard
bool
waitlist_append
(
waitlist_t
*list);
29
size_t
waitlist_wake
(
waitlist_t
*list,
size_t
max_wakeups);
30
void
waitlist_close
(
waitlist_t
*list);
31
void
waitlist_remove_me
(
waitlist_t
*waitlist);
32
33
#define waitlist_wake_one(list) waitlist_wake(list, 1)
34
#define waitlist_wake_all(list) waitlist_wake(list, SIZE_MAX)
allocator.hpp
list_head
list_node_t list_head
A linked list head.
Definition
list.hpp:23
mos_global.h
__nodiscard
#define __nodiscard
Definition
mos_global.h:35
list.hpp
spinlock.hpp
mos::NamedType
Definition
type_utils.hpp:24
spinlock_t
Definition
spinlock.hpp:14
waitable_list_entry_t
The entry in the waiters list of a process, or a thread.
Definition
wait.hpp:14
waitable_list_entry_t::waiter
tid_t waiter
Definition
wait.hpp:16
waitable_list_entry_t::as_linked_list
as_linked_list
Definition
wait.hpp:15
waitlist_t
Definition
wait.hpp:20
waitlist_t::closed
bool closed
Definition
wait.hpp:21
waitlist_t::waitlist_t
waitlist_t()
Definition
wait.cpp:95
waitlist_t::lock
spinlock_t lock
Definition
wait.hpp:22
waitlist_t::list
list_head list
Definition
wait.hpp:23
tid_t
s32 tid_t
Definition
types.h:75
waitlist_init
void waitlist_init(waitlist_t *list)
Definition
wait.cpp:15
waitlist_wake
size_t waitlist_wake(waitlist_t *list, size_t max_wakeups)
Definition
wait.cpp:37
waitlist_remove_me
void waitlist_remove_me(waitlist_t *waitlist)
Definition
wait.cpp:78
waitlist_close
void waitlist_close(waitlist_t *list)
Definition
wait.cpp:68
waitlist_append
__nodiscard bool waitlist_append(waitlist_t *list)
Definition
wait.cpp:21
kernel
include
private
mos
tasks
wait.hpp
Generated on Tue Feb 18 2025 16:41:40 for MOS Source Code by
1.13.2