From 821fe7bf16c57d690f4f92997f4e51abb93e0347 Mon Sep 17 00:00:00 2001 From: Andreas Hindborg Date: Wed, 24 Sep 2025 14:39:24 +0200 Subject: rust: sync: add `SetOnce` Introduce the `SetOnce` type, a container that can only be written once. The container uses an internal atomic to synchronize writes to the internal value. Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg Tested-by: Daniel Gomez Signed-off-by: Daniel Gomez --- rust/kernel/sync.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rust/kernel/sync.rs') diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs index cf5b638a097d..3f957ad3a9f0 100644 --- a/rust/kernel/sync.rs +++ b/rust/kernel/sync.rs @@ -20,6 +20,7 @@ mod locked_by; pub mod poll; pub mod rcu; mod refcount; +mod set_once; pub use arc::{Arc, ArcBorrow, UniqueArc}; pub use completion::Completion; @@ -29,6 +30,7 @@ pub use lock::mutex::{new_mutex, Mutex, MutexGuard}; pub use lock::spinlock::{new_spinlock, SpinLock, SpinLockGuard}; pub use locked_by::LockedBy; pub use refcount::Refcount; +pub use set_once::SetOnce; /// Represents a lockdep class. It's a wrapper around C's `lock_class_key`. #[repr(transparent)] -- cgit