stackful 0.1.5

Bridge between sync and async
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::sync::atomic::{AtomicUsize, Ordering};

static PAGE_SIZE: AtomicUsize = AtomicUsize::new(0);

pub fn get() -> usize {
    let mut ret = PAGE_SIZE.load(Ordering::Relaxed);
    if ret == 0 {
        ret = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };
        assert!(ret >= 4096, "page size must be no smaller than 4KiB");
        PAGE_SIZE.store(ret, Ordering::Relaxed);
    }
    ret
}