mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 21:24:11 -04:00
ams: prefer construct_at/destroy_at over placement new/explicit destructor
This commit is contained in:
parent
aff0da9427
commit
d84dcb653d
49 changed files with 217 additions and 171 deletions
|
@ -21,9 +21,9 @@ namespace ams::os {
|
|||
|
||||
void InitalizeReadWriteLock(ReadWriteLockType *rw_lock) {
|
||||
/* Create objects. */
|
||||
new (GetPointer(impl::GetLockCount(rw_lock).cs_storage)) impl::InternalCriticalSection;
|
||||
new (GetPointer(rw_lock->cv_read_lock._storage)) impl::InternalConditionVariable;
|
||||
new (GetPointer(rw_lock->cv_write_lock._storage)) impl::InternalConditionVariable;
|
||||
util::ConstructAt(impl::GetLockCount(rw_lock).cs_storage);
|
||||
util::ConstructAt(rw_lock->cv_read_lock._storage);
|
||||
util::ConstructAt(rw_lock->cv_write_lock._storage);
|
||||
|
||||
/* Set member variables. */
|
||||
impl::ClearReadLockCount(impl::GetLockCount(rw_lock));
|
||||
|
@ -48,9 +48,9 @@ namespace ams::os {
|
|||
rw_lock->state = ReadWriteLockType::State_NotInitialized;
|
||||
|
||||
/* Destroy objects. */
|
||||
GetReference(rw_lock->cv_write_lock._storage).~InternalConditionVariable();
|
||||
GetReference(rw_lock->cv_read_lock._storage).~InternalConditionVariable();
|
||||
GetReference(impl::GetLockCount(rw_lock).cs_storage).~InternalCriticalSection();
|
||||
util::DestroyAt(rw_lock->cv_write_lock._storage);
|
||||
util::DestroyAt(rw_lock->cv_read_lock._storage);
|
||||
util::DestroyAt(impl::GetLockCount(rw_lock).cs_storage);
|
||||
}
|
||||
|
||||
void AcquireReadLock(ReadWriteLockType *rw_lock) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue