Use util::mutexed in audio::channel if atomic_ptr<shared_ptr> is not supported

This commit is contained in:
Nikita Lisitsa 2026-06-30 14:40:47 +03:00
parent 99978c3241
commit a9094975be

View file

@ -1,8 +1,14 @@
#pragma once #pragma once
#include <psemek/audio/stream.hpp> #include <version>
#include <psemek/audio/stream.hpp>
#ifdef __cpp_lib_atomic_shared_ptr
#include <atomic> #include <atomic>
#else
#include <psemek/util/mutexed.hpp>
#endif
#include <memory> #include <memory>
namespace psemek::audio namespace psemek::audio
@ -37,7 +43,11 @@ namespace psemek::audio
} }
private: private:
#ifdef __cpp_lib_atomic_shared_ptr
std::atomic<stream_ptr> stream_; std::atomic<stream_ptr> stream_;
#else
util::mutexed<stream_ptr> stream_;
#endif
}; };
using channel_ptr = std::shared_ptr<channel>; using channel_ptr = std::shared_ptr<channel>;