mirror of
https://github.com/bspeice/qadapt
synced 2024-11-21 13:28:11 -05:00
Minor note about protection level during release
This commit is contained in:
parent
8838070a1b
commit
87beb53ccd
10
src/lib.rs
10
src/lib.rs
@ -263,7 +263,9 @@ macro_rules! assert_no_alloc {
|
||||
static IS_ACTIVE: RwLock<bool> = RwLock::new(false);
|
||||
static INTERNAL_ALLOCATION: RwLock<usize> = RwLock::new(usize::max_value());
|
||||
|
||||
/// Get the current "protection level" in QADAPT: calls to enter_protected() - exit_protected()
|
||||
/// Get the current "protection level" in QADAPT: calls to `enter_protected() - exit_protected()`.
|
||||
///
|
||||
/// **Note**: For release builds, `protection_level()` will always return 0.
|
||||
///
|
||||
/// **Example**:
|
||||
///
|
||||
@ -290,11 +292,7 @@ static INTERNAL_ALLOCATION: RwLock<usize> = RwLock::new(usize::max_value());
|
||||
/// // It's now safe to allocate/drop
|
||||
/// }
|
||||
pub fn protection_level() -> usize {
|
||||
if cfg!(debug_assertions) {
|
||||
PROTECTION_LEVEL.try_with(|v| *v.read()).unwrap_or(0)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
PROTECTION_LEVEL.try_with(|v| *v.read()).unwrap_or(0)
|
||||
}
|
||||
|
||||
/// Determine whether qadapt is running as the current global allocator. Useful for
|
||||
|
Loading…
Reference in New Issue
Block a user