diff --git a/Source/Shared/arcana/threading/cancellation.h b/Source/Shared/arcana/threading/cancellation.h index b75ee12..d50613a 100644 --- a/Source/Shared/arcana/threading/cancellation.h +++ b/Source/Shared/arcana/threading/cancellation.h @@ -9,7 +9,6 @@ #include #include -#include namespace arcana { @@ -129,34 +128,9 @@ namespace arcana std::atomic m_cancellationRequested{ false }; }; - namespace internal::no_destroy_cancellation - { - // To address a problem with static globals recognized as the same as in a - // standards proposal, we adopt a workaround described in the proposal. - // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1247r0.html - template - class no_destroy - { - alignas(T) unsigned char data_[sizeof(T)]; - - public: - template - no_destroy(Ts&&... ts) - { - new (data_)T(std::forward(ts)...); - } - - T &get() - { - return *reinterpret_cast(data_); - } - }; - - inline no_destroy none{}; - } - inline cancellation& cancellation::none() { - return internal::no_destroy_cancellation::none.get(); + static thread_local cancellation_source n{}; + return n; } }