shared_memory
A user friendly crate that allows you to share memory between processes.
This crate aims to provide lightweight wrappers around shared memory mappings in an OS agnostic way while also providing an abstraction layer on commonly used synchronization primitives.
Usage
For usage examples, see code located in examples/ :
Examples | Description |
---|---|
basic | Basic use of the library when all you need is memory protected by one lock |
custom | Shows the more advanced usage of the crate with configs and events |
raw | Create/Open raw mappings that are not managed by this crate |
Synchronization Primitives
Feature | Description | Linux | Windows | Mac** | FreeBSD** |
---|---|---|---|---|---|
LockType::Mutex | Mutually exclusive lock | ✔ | ✔ | ✔ | ✔ |
LockType::RwLock | Exlusive write/shared read | ✔ | X#1 | ✔ | ✔ |
EventType::Auto/Manual | Generic event : pthread_cond on Unix and Event Objects on windows. | ✔ | ✔ | X#14 | ✔ |
EventType::*Busy | Busy event managed by polling an AtomicBool in a loop | ✔ | ✔ | ✔ | ✔ |
EventType::*EventFd | Linux specific event type | ✔ | N/A | N/A | N/A |
* Events take the Auto or Manual prefix to indicate whether signals are automatically "consumed" by waiting threads or not ** I do not own a Mac (or have FreeBSD installed) so my validation is limited to "build only" on these platforms
License
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.