Crates.io | atomic_fn |
lib.rs | atomic_fn |
version | 0.2.1 |
source | src |
created_at | 2022-04-03 14:02:20.614363 |
updated_at | 2022-04-03 14:02:20.614363 |
description | Generic AtomicFnPtr |
homepage | |
repository | https://github.com/TheOtherAnxxity/atomic_fn |
max_upload_size | |
id | 561304 |
size | 37,648 |
A library which provides a generic AtomicFnPtr<T>
type for all T
where T
is a
function pointer such as fn()
or fn(usize) -> usize
.
Probably works, but not recommended for serious use yet.
This library always uses native atomic instructions since function pointers almost always have the right size and alignment for atomic loads and stores. In case function pointers on the target platform do not have the right size or alignment for atomic loads and stores, the library fails to compile, and if that is bypassed, there are runtime guards that panic if the size or alignment is not supported.
This crate uses #![no_std]
and only depends on libcore.
Add this to your Cargo.toml:
[dependencies]
atomic_fn = "0.2"
and this to your crate root:
extern crate atomic;
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.