mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 22:47:03 +00:00
orbis: remove process list from context & initial serialization support
modernize kenv add LockableKernelObject utility
This commit is contained in:
parent
f71e3410c1
commit
014012c219
22 changed files with 372 additions and 215 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "rx/Rc.hpp"
|
||||
#include "rx/Serializer.hpp"
|
||||
#include "rx/SharedMutex.hpp"
|
||||
#include "rx/TypeId.hpp"
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
|
@ -44,6 +45,28 @@ struct KernelObject : KernelObjectBase, StateT {
|
|||
}
|
||||
};
|
||||
|
||||
template <rx::Serializable StateT>
|
||||
struct LockableKernelObject : KernelObjectBase, StateT {
|
||||
mutable rx::shared_mutex mtx;
|
||||
|
||||
template <typename... Args>
|
||||
LockableKernelObject(Args &&...args)
|
||||
: KernelObjectBase(rx::TypeId::get<StateT>()),
|
||||
StateT(std::forward<Args>(args)...) {}
|
||||
|
||||
virtual void serialize(rx::Serializer &s) const {
|
||||
std::lock_guard lock(*this);
|
||||
s.serialize(static_cast<const StateT &>(*this));
|
||||
}
|
||||
|
||||
virtual void deserialize(rx::Deserializer &s) {
|
||||
s.deserialize(static_cast<StateT &>(*this));
|
||||
}
|
||||
|
||||
void lock() const { mtx.lock(); }
|
||||
void unlock() const { mtx.unlock(); }
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
struct StaticObjectCtl {
|
||||
std::size_t offset = -1ull;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue