2020-03-31 18:54:28 +02:00
|
|
|
// Copyright 2020 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2019-08-11 01:20:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
#include <boost/serialization/split_free.hpp>
|
|
|
|
|
2019-12-27 19:52:33 +01:00
|
|
|
namespace boost::serialization {
|
|
|
|
|
|
|
|
template <class Archive, class T>
|
2019-12-27 22:07:29 +01:00
|
|
|
void serialize(Archive& ar, std::atomic<T>& value, const unsigned int file_version) {
|
2019-12-27 19:52:33 +01:00
|
|
|
boost::serialization::split_free(ar, value, file_version);
|
|
|
|
}
|
2019-08-11 01:20:09 +02:00
|
|
|
|
2019-12-27 19:52:33 +01:00
|
|
|
template <class Archive, class T>
|
2019-12-27 22:07:29 +01:00
|
|
|
void save(Archive& ar, const std::atomic<T>& value, const unsigned int file_version) {
|
2019-12-27 19:52:33 +01:00
|
|
|
ar << value.load();
|
|
|
|
}
|
2019-08-11 01:20:09 +02:00
|
|
|
|
2019-12-27 19:52:33 +01:00
|
|
|
template <class Archive, class T>
|
2019-12-27 22:07:29 +01:00
|
|
|
void load(Archive& ar, std::atomic<T>& value, const unsigned int file_version) {
|
2019-12-27 19:52:33 +01:00
|
|
|
T tmp;
|
|
|
|
ar >> tmp;
|
|
|
|
value.store(tmp);
|
|
|
|
}
|
2019-08-11 01:20:09 +02:00
|
|
|
|
|
|
|
} // namespace boost::serialization
|