Skip to content

Commit

Permalink
Move set_oom_hook and take_oom_hook to a dedicated tracking issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Jun 11, 2018
1 parent 125b259 commit 90d1972
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libstd/alloc.rs
Expand Up @@ -37,7 +37,7 @@ static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut());
/// about the allocation that failed.
///
/// The OOM hook is a global resource.
#[unstable(feature = "allocator_api", issue = "32838")]
#[unstable(feature = "oom_hook", issue = "51245")]
pub fn set_oom_hook(hook: fn(Layout)) {
HOOK.store(hook as *mut (), Ordering::SeqCst);
}
Expand All @@ -47,7 +47,7 @@ pub fn set_oom_hook(hook: fn(Layout)) {
/// *See also the function [`set_oom_hook`].*
///
/// If no custom hook is registered, the default hook will be returned.
#[unstable(feature = "allocator_api", issue = "32838")]
#[unstable(feature = "oom_hook", issue = "51245")]
pub fn take_oom_hook() -> fn(Layout) {
let hook = HOOK.swap(ptr::null_mut(), Ordering::SeqCst);
if hook.is_null() {
Expand Down

0 comments on commit 90d1972

Please sign in to comment.