mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 14:37:08 +00:00
[orbis-kernel] evf: implement shared evf
Protect shared evfs with mutex Fixed memory leak on shared evf allocation Fixed set condition on wait Update RcIdMap usage to use new api
This commit is contained in:
parent
e613f09b6d
commit
800c1ffcdc
6 changed files with 50 additions and 22 deletions
|
|
@ -27,12 +27,19 @@ public:
|
|||
|
||||
std::pair<EventFlag *, bool> createEventFlag(utils::kstring name,
|
||||
std::int32_t flags) {
|
||||
auto [it, inserted] =
|
||||
m_event_flags.try_emplace(std::move(name), knew<EventFlag>(flags));
|
||||
std::lock_guard lock(m_evf_mtx);
|
||||
|
||||
auto [it, inserted] = m_event_flags.try_emplace(std::move(name), nullptr);
|
||||
if (inserted) {
|
||||
it->second = knew<EventFlag>(flags);
|
||||
}
|
||||
|
||||
return {it->second.get(), inserted};
|
||||
}
|
||||
|
||||
Ref<EventFlag> findEventFlag(std::string_view name) {
|
||||
std::lock_guard lock(m_evf_mtx);
|
||||
|
||||
if (auto it = m_event_flags.find(name); it != m_event_flags.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
|
@ -41,6 +48,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
shared_mutex m_evf_mtx;
|
||||
mutable pthread_mutex_t m_heap_mtx;
|
||||
void *m_heap_next = this + 1;
|
||||
bool m_heap_is_freeing = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue