#include <stdbool.h>
#include <common/list.h>
#include <kernel/kernel.h>
#include <kernel/sched.h>
#include <kernel/thread.h>
Go to the source code of this file.
◆ DECLARE_WAIT_QUEUE_HEAD
#define DECLARE_WAIT_QUEUE_HEAD |
( |
|
name | ) |
LIST_HEAD(name) |
Declare and initialize a wait queue.
- Parameters
-
name | Name of the wait queue variable. |
- Return values
-
◆ init_waitqueue_head
Initialize the wait queue.
- Parameters
-
list | The wait queue to initialize. |
- Return values
-
◆ wait_event
#define wait_event |
( |
|
wq_head, |
|
|
|
condition |
|
) |
| |
Value: do { \
CURRENT_THREAD_INFO(curr_thread); \
while (1) { \
if (condition) \
break; \
prepare_to_wait(&wq_head, curr_thread, THREAD_WAIT); \
schedule(); \
} \
} while (0)
Wait until the condition became true.
- Parameters
-
wq_head | The wait queue to sleep. |
condition | The condition to wait until true. |
- Return values
-
◆ finish_wait()
Move the thread from a wait list into a ready list and set it to be ready.
- Parameters
-
wait | The pointer that point to the thread to wake up. |
- Return values
-
◆ prepare_to_wait()
Suspend current thread and place it into a wait list with a new state.
- Parameters
-
wait_list | Thread waiting list. |
thread | The thread to to place in the wait list. |
state | The new state of the thread. |
- Return values
-
◆ wake_up()
Wake up the highest priority thread from the wait list.
- Parameters
-
wait_list | The wait list that contains suspended threads. |
- Return values
-
◆ wake_up_all()
void wake_up_all |
( |
struct list_head * |
wait_list | ) |
|
Wake up all threads from the wait list.
- Parameters
-
wait_list | The wait list that contains suspended threads. |
- Return values
-