aboutsummaryrefslogtreecommitdiffstats
path: root/core/device.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2024-01-01 15:54:30 -0800
committerChris Robinson <[email protected]>2024-01-01 15:54:30 -0800
commit70a8cf88041d88c49dcd258587e6b84960752851 (patch)
tree50acfdf6587a68e985aa713567b2e997cb5eef4f /core/device.cpp
parent936e654b261b4d1cb604a44da534ba385aa10099 (diff)
Use an atomic unique_ptr for the device's context array
Diffstat (limited to 'core/device.cpp')
-rw-r--r--core/device.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/core/device.cpp b/core/device.cpp
index a5edf63c..795a9601 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -12,15 +12,9 @@
static_assert(std::atomic<std::chrono::nanoseconds>::is_always_lock_free);
-al::FlexArray<ContextBase*> DeviceBase::sEmptyContextArray{0u};
-
-
-DeviceBase::DeviceBase(DeviceType type) : Type{type}, mContexts{&sEmptyContextArray}
+DeviceBase::DeviceBase(DeviceType type)
+ : Type{type}, mContexts{al::FlexArray<ContextBase*>::Create(0)}
{
}
-DeviceBase::~DeviceBase()
-{
- auto *oldarray = mContexts.exchange(nullptr, std::memory_order_relaxed);
- if(oldarray != &sEmptyContextArray) delete oldarray;
-}
+DeviceBase::~DeviceBase() = default;