Lines Matching +full:wait +full:- +full:pin
1 // SPDX-License-Identifier: GPL-2.0
22 /// Creates a [`CondVar`] initialiser with the given name and a newly-created lock class.
51 /// #[pin]
54 /// #[pin]
62 /// e.value_changed.wait(&mut guard);
73 /// fn new_example() -> Result<Pin<KBox<Example>>> {
75 /// value <- new_mutex!(0),
76 /// value_changed <- new_condvar!(),
81 /// [`struct wait_queue_head`]: srctree/include/linux/wait.h
84 #[pin]
88 /// self-referential, so it cannot be safely moved once it is initialised.
91 #[pin]
104 pub fn new(name: &'static CStr, key: &'static LockClassKey) -> impl PinInit<Self> {
109 wait_queue_head <- Opaque::ffi_init(|slot| unsafe {
120 ) -> c_long {
121 let wait = Opaque::<bindings::wait_queue_entry>::uninit();
123 // SAFETY: `wait` points to valid memory.
124 unsafe { bindings::init_wait(wait.get()) };
126 // SAFETY: Both `wait` and `wait_queue_head` point to valid memory.
128 bindings::prepare_to_wait_exclusive(self.wait_queue_head.get(), wait.get(), wait_state)
134 // SAFETY: Both `wait` and `wait_queue_head` point to valid memory.
135 unsafe { bindings::finish_wait(self.wait_queue_head.get(), wait.get()) };
146 pub fn wait<T: ?Sized, B: Backend>(&self, guard: &mut Guard<'_, T, B>) {
152 /// Similar to [`CondVar::wait`], except that the wait is interruptible. That is, the thread may
157 pub fn wait_interruptible<T: ?Sized, B: Backend>(&self, guard: &mut Guard<'_, T, B>) -> bool {
172 ) -> CondVarTimeoutResult {