debra_common/
lib.rs

1//! Common types, traits and base functionality for the DEBRA reclamation
2//! scheme.
3//!
4//! This crate forms the common basis for both the `debra` and `debra-simple`
5//! crates.
6
7#![cfg_attr(not(feature = "std"), no_std)]
8#![warn(missing_docs)]
9
10#[cfg(not(feature = "std"))]
11extern crate alloc;
12#[cfg(test)]
13extern crate std;
14
15pub use arrayvec;
16pub use reclaim;
17
18use reclaim::{Reclaim, Retired};
19
20pub mod bag;
21pub mod epoch;
22pub mod thread;
23
24/// A trait for abstracting over different ways for accessing thread local
25/// state.
26pub trait LocalAccess
27where
28    Self: Clone + Copy + Sized,
29{
30    /// The concrete reclamation scheme type.
31    type Reclaimer: Reclaim;
32
33    /// Returns `true` if the current thread is already active.
34    fn is_active(self) -> bool;
35    /// Marks the associated thread as active.
36    fn set_active(self);
37    /// Marks the associated thread as inactive.
38    fn set_inactive(self);
39    /// Retires an unlinked record in the local cache.
40    fn retire_record(self, record: Retired<Self::Reclaimer>);
41}
42
43include!(concat!(env!("OUT_DIR"), "/build_constants.rs"));
44
45/// The value of the configurable per-thread size for individual bags storing
46/// cached retired records.
47pub const EPOCH_CACHE_SIZE: usize = DEBRA_EPOCH_CACHE_SIZE;