]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: sync: add `SetOnce`
authorAndreas Hindborg <a.hindborg@kernel.org>
Wed, 24 Sep 2025 12:39:24 +0000 (14:39 +0200)
committerDaniel Gomez <da.gomez@kernel.org>
Mon, 3 Nov 2025 13:40:35 +0000 (14:40 +0100)
commit821fe7bf16c57d690f4f92997f4e51abb93e0347
tree1c9e29562eabdeb4f93a1fec1d49f8fde4e5e5fe
parentdcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa
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 <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Tested-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Daniel Gomez <da.gomez@kernel.org>
rust/kernel/sync.rs
rust/kernel/sync/set_once.rs [new file with mode: 0644]