mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-03-02 07:27:26 +00:00
[orbis-kernel] Event flag fixes
This commit is contained in:
parent
e9ffa97caa
commit
00690fd685
@ -65,6 +65,7 @@ public:
|
||||
auto [it, inserted] = m_event_flags.try_emplace(std::move(name), nullptr);
|
||||
if (inserted) {
|
||||
it->second = knew<EventFlag>(flags, initPattern);
|
||||
std::strncpy(it->second->name, it->first.c_str(), 32);
|
||||
}
|
||||
|
||||
return {it->second.get(), inserted};
|
||||
@ -106,7 +107,6 @@ 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;
|
||||
@ -119,6 +119,8 @@ private:
|
||||
|
||||
mutable shared_mutex m_proc_mtx;
|
||||
utils::LinkedNode<Process> *m_processes = nullptr;
|
||||
|
||||
shared_mutex m_evf_mtx;
|
||||
utils::kmap<utils::kstring, Ref<EventFlag>> m_event_flags;
|
||||
};
|
||||
|
||||
|
@ -94,9 +94,10 @@ orbis::SysResult orbis::sys_evf_create(Thread *thread, ptr<const char[32]> name,
|
||||
}
|
||||
|
||||
switch (attrs & (kEvfAttrSingle | kEvfAttrMulti)) {
|
||||
case 0:
|
||||
case kEvfAttrSingle | kEvfAttrMulti:
|
||||
attrs = (attrs & ~(kEvfAttrSingle | kEvfAttrMulti)) | kEvfAttrSingle;
|
||||
return ErrorCode::INVAL;
|
||||
case 0:
|
||||
attrs |= kEvfAttrSingle;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -104,9 +105,10 @@ orbis::SysResult orbis::sys_evf_create(Thread *thread, ptr<const char[32]> name,
|
||||
}
|
||||
|
||||
switch (attrs & (kEvfAttrThPrio | kEvfAttrThFifo)) {
|
||||
case 0:
|
||||
case kEvfAttrThPrio | kEvfAttrThFifo:
|
||||
attrs = (attrs & ~(kEvfAttrThPrio | kEvfAttrThFifo)) | kEvfAttrThFifo;
|
||||
return ErrorCode::INVAL;
|
||||
case 0:
|
||||
attrs |= kEvfAttrThFifo;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -131,6 +133,7 @@ orbis::SysResult orbis::sys_evf_create(Thread *thread, ptr<const char[32]> name,
|
||||
eventFlag = insertedEvf;
|
||||
} else {
|
||||
eventFlag = knew<EventFlag>(attrs, initPattern);
|
||||
std::strncpy(eventFlag->name, _name, 32);
|
||||
}
|
||||
|
||||
thread->retval[0] = thread->tproc->evfMap.insert(eventFlag);
|
||||
@ -162,7 +165,6 @@ orbis::SysResult orbis::sys_evf_open(Thread *thread, ptr<const char[32]> name) {
|
||||
return ErrorCode::SRCH;
|
||||
}
|
||||
|
||||
std::strcpy(eventFlag->name, _name);
|
||||
thread->retval[0] = thread->tproc->evfMap.insert(eventFlag);
|
||||
return {};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user