Files
snmalloc/src/pal/pal_plain.h
Matthew Parkinson 20a114cb62 Add a timer to the PAL
This adds a way to periodically pool the PAL to see if any timers have
expired.  Timers can be used to periodically provide callbacks to the
rest of snmalloc.
2021-10-28 14:28:36 +01:00

33 lines
742 B
C++

#pragma once
#include "../ds/bits.h"
#include "pal_timer_default.h"
namespace snmalloc
{
// Can be extended
// Will require a reserve method in subclasses.
template<class State>
class PALPlainMixin : public State, public PalTimerDefaultImpl<State>
{
public:
// Notify platform that we will not be using these pages
static void notify_not_using(void*, size_t) noexcept {}
// Notify platform that we will not be using these pages
template<ZeroMem zero_mem>
static void notify_using(void* p, size_t size) noexcept
{
if constexpr (zero_mem == YesZero)
{
State::zero(p, size);
}
else
{
UNUSED(p);
UNUSED(size);
}
}
};
} // namespace snmalloc