os: refactor/rewrite entire namespace.
This commit is contained in:
@@ -33,12 +33,6 @@ namespace ams::lmem::impl {
|
||||
new (&out->list_node) util::IntrusiveListNode;
|
||||
new (&out->child_list) decltype(out->child_list);
|
||||
|
||||
/* Only initialize mutex if option requires it. */
|
||||
if (option & CreateOption_ThreadSafe) {
|
||||
static_assert(std::is_trivially_destructible<os::Mutex>::value);
|
||||
new (&out->mutex) os::Mutex;
|
||||
}
|
||||
|
||||
/* Set fields. */
|
||||
out->magic = magic;
|
||||
out->heap_start = start;
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace ams::lmem::impl {
|
||||
public:
|
||||
explicit ScopedHeapLock(HeapHandle h) : handle(h) {
|
||||
if (this->handle->option & CreateOption_ThreadSafe) {
|
||||
this->handle->mutex.Lock();
|
||||
os::LockMutex(std::addressof(this->handle->mutex));
|
||||
}
|
||||
}
|
||||
|
||||
~ScopedHeapLock() {
|
||||
if (this->handle->option & CreateOption_ThreadSafe) {
|
||||
this->handle->mutex.Unlock();
|
||||
os::UnlockMutex(std::addressof(this->handle->mutex));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user