mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-31 23:08:22 -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
|
@ -33,7 +33,7 @@ namespace ams::os::impl {
|
|||
event->auto_clear = (clear_mode == EventClearMode_AutoClear);
|
||||
|
||||
/* Create the waitlist node. */
|
||||
new (GetPointer(event->waitable_object_list_storage)) impl::WaitableObjectList;
|
||||
util::ConstructAt(event->waitable_object_list_storage);
|
||||
|
||||
/* Set state. */
|
||||
event->state = InterProcessEventType::State_Initialized;
|
||||
|
@ -71,7 +71,7 @@ namespace ams::os::impl {
|
|||
}
|
||||
|
||||
/* Destroy the waitlist. */
|
||||
GetReference(event->waitable_object_list_storage).~WaitableObjectList();
|
||||
util::DestroyAt(event->waitable_object_list_storage);
|
||||
}
|
||||
|
||||
void AttachInterProcessEvent(InterProcessEventType *event, Handle read_handle, bool read_handle_managed, Handle write_handle, bool write_handle_managed, EventClearMode clear_mode) {
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace ams::os::impl {
|
|||
public:
|
||||
static ALWAYS_INLINE void InitializeResourceManagerInstance() {
|
||||
/* Construct the resource manager instance. */
|
||||
new (GetPointer(s_resource_manager_storage)) OsResourceManager;
|
||||
util::ConstructAt(s_resource_manager_storage);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE OsResourceManager &GetResourceManagerInstance() {
|
||||
|
|
|
@ -24,11 +24,11 @@ namespace ams::os::impl {
|
|||
|
||||
void SetupThreadObjectUnsafe(ThreadType *thread, ThreadImpl *thread_impl, ThreadFunction function, void *arg, void *stack, size_t stack_size, s32 priority) {
|
||||
/* Setup objects. */
|
||||
new (GetPointer(thread->cs_thread)) impl::InternalCriticalSection;
|
||||
new (GetPointer(thread->cv_thread)) impl::InternalConditionVariable;
|
||||
util::ConstructAt(thread->cs_thread);
|
||||
util::ConstructAt(thread->cv_thread);
|
||||
|
||||
new (GetPointer(thread->all_threads_node)) util::IntrusiveListNode;
|
||||
new (GetPointer(thread->waitlist)) WaitableObjectList;
|
||||
util::ConstructAt(thread->all_threads_node);
|
||||
util::ConstructAt(thread->waitlist);
|
||||
|
||||
/* Set member variables. */
|
||||
thread->thread_impl = (thread_impl != nullptr) ? thread_impl : std::addressof(thread->thread_impl_storage);
|
||||
|
@ -131,7 +131,7 @@ namespace ams::os::impl {
|
|||
|
||||
thread->state = ThreadType::State_NotInitialized;
|
||||
|
||||
GetReference(thread->waitlist).~WaitableObjectList();
|
||||
util::DestroyAt(thread->waitlist);
|
||||
|
||||
thread->name_buffer[0] = '\x00';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue