diff options
| author | Wedson Almeida Filho <[email protected]> | 2023-03-26 03:57:38 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2023-04-21 23:46:45 +0000 |
| commit | 19096bce815716cf93fc1ef3965629c3affa26f1 (patch) | |
| tree | bb4d7969a0b433979d3f4a5b64ac2cc50d76078d /rust/helpers.c | |
| parent | rust: lock: add `Guard::do_unlocked` (diff) | |
| download | kernel-19096bce815716cf93fc1ef3965629c3affa26f1.tar.gz kernel-19096bce815716cf93fc1ef3965629c3affa26f1.zip | |
rust: sync: introduce `CondVar`
This is the traditional condition variable or monitor synchronisation
primitive. It is implemented with C's `wait_queue_head_t`.
It allows users to release a lock and go to sleep while guaranteeing
that notifications won't be missed. This is achieved by enqueuing a wait
entry before releasing the lock.
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Waiman Long <[email protected]>
Reviewed-by: Martin Rodriguez Reboredo <[email protected]>
Signed-off-by: Wedson Almeida Filho <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/helpers.c')
| -rw-r--r-- | rust/helpers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rust/helpers.c b/rust/helpers.c index 2cb7b82053d8..81e80261d597 100644 --- a/rust/helpers.c +++ b/rust/helpers.c @@ -25,6 +25,7 @@ #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/sched/signal.h> +#include <linux/wait.h> __noreturn void rust_helper_BUG(void) { @@ -61,6 +62,12 @@ void rust_helper_spin_unlock(spinlock_t *lock) } EXPORT_SYMBOL_GPL(rust_helper_spin_unlock); +void rust_helper_init_wait(struct wait_queue_entry *wq_entry) +{ + init_wait(wq_entry); +} +EXPORT_SYMBOL_GPL(rust_helper_init_wait); + int rust_helper_signal_pending(struct task_struct *t) { return signal_pending(t); |
