1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

Kernel: Yet more work on bringing up POSIX SHM.

This commit is contained in:
Andreas Kling 2019-04-09 02:37:05 +02:00
parent d6ff64db00
commit 60a819c14a
7 changed files with 97 additions and 9 deletions

View file

@ -58,6 +58,14 @@ public:
T& value() { ASSERT(!m_is_error); return *reinterpret_cast<T*>(&m_storage); }
const T& value() const { ASSERT(!m_is_error); return *reinterpret_cast<T*>(&m_storage); }
T release_value()
{
ASSERT(!m_is_error);
T released_value = *reinterpret_cast<T*>(&m_storage);
value().~T();
return released_value;
}
private:
char m_storage[sizeof(T)] __attribute__((aligned(sizeof(T))));
KResult m_error;