22 #include <system_error> 33 long pagesize = sysconf(_SC_PAGESIZE);
34 size_t mmapLength = ((size - 1) & ~(pagesize - 1)) + pagesize;
35 assert(size <= mmapLength && mmapLength < size + pagesize);
36 assert((mmapLength % pagesize) == 0);
45 #if defined(MAP_POPULATE) 50 void* mem =
static_cast<void*
>(mmap(
53 PROT_READ | PROT_WRITE,
54 MAP_PRIVATE | MAP_ANONYMOUS | extraflags,
57 if (mem == reinterpret_cast<void*>(-1)) {
58 throw std::system_error(errno, std::system_category());
60 #if !defined(MAP_POPULATE) && defined(MADV_WILLNEED) 61 madvise(mem, size, MADV_WILLNEED);
73 template <
typename Allocator>
void deallocate(void *p, size_t size)
—— Concurrent Priority Queue Implementation ——
bool_constant< true > true_type
constexpr auto size(C const &c) -> decltype(c.size())
void * allocate(size_t size)
size_t computeSize(size_t size)
bool_constant< false > false_type