atomic_fn

Crates.ioatomic_fn
lib.rsatomic_fn
version0.2.1
sourcesrc
created_at2022-04-03 14:02:20.614363
updated_at2022-04-03 14:02:20.614363
descriptionGeneric AtomicFnPtr wrapper type for atomic function pointers
homepage
repositoryhttps://github.com/TheOtherAnxxity/atomic_fn
max_upload_size
id561304
size37,648
(TheOtherAnxxity)

documentation

https://docs.rs/atomic_fn/latest/

README

atomic_fn

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.

Usage

Add this to your Cargo.toml:

[dependencies]
atomic_fn = "0.2"

and this to your crate root:

extern crate atomic;

License

Licensed under either of

at your option.

Contribution

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.

Commit count: 5

cargo fmt