vm_native.cpp: Use Windows 10 memory mapping API (the correct API)

This commit is contained in:
Elad Ashkenazi 2022-06-10 14:27:02 +03:00 committed by GitHub
parent 7235647e67
commit 1738b38536
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 233 additions and 20 deletions

View file

@ -3,7 +3,7 @@
#include "util/types.hpp"
#include "util/atomic.hpp"
//! Simple sizeless array base for concurrent access. Cannot shrink, only growths automatically.
//! Simple unshrinkable array base for concurrent access. Only growths automatically.
//! There is no way to know the current size. The smaller index is, the faster it's accessed.
//!
//! T is the type of elements. Currently, default constructor of T shall be constexpr.
@ -47,6 +47,18 @@ public:
// Access recursively
return (*m_next)[index - N];
}
u64 size() const
{
u64 size_n = 0;
for (auto ptr = this; ptr; ptr = ptr->m_next)
{
size_n += N;
}
return size_n;
}
};
//! Simple lock-free FIFO queue base. Based on lf_array<T, N> itself. Currently uses 32-bit counters.