1 unstable release
0.2.1 | Apr 3, 2022 |
---|
#339 in No standard library
77 downloads per month
Used in 3 crates
(via simple_pg_client)
24KB
259 lines
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
- Apache License, Version 2.0 (LICENSE-APACHE or opensource.org/licenses/Apache-2.0)
- MIT License (LICENSE-MIT or opensource.org/licenses/MIT)
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.