[orbis-kernel] Trace sys_evf

This commit is contained in:
Ivan Chikish 2023-07-12 17:23:59 +03:00
parent 1550bfc7b1
commit 204336989d
2 changed files with 11 additions and 0 deletions

View file

@ -133,6 +133,8 @@ std::size_t orbis::EventFlag::notify(NotifyType type, std::uint64_t bits) {
}
// TODO: update thread state
if (thread->mtx->is_free())
std::abort();
thread->mtx->unlock(); // release wait on waiter thread
waitingThreadsCount.fetch_sub(1, std::memory_order::relaxed);

View file

@ -165,6 +165,7 @@ orbis::SysResult orbis::sys_evf_open(Thread *thread, ptr<const char[32]> name) {
return {};
}
orbis::SysResult orbis::sys_evf_close(Thread *thread, sint id) {
ORBIS_LOG_WARNING(__FUNCTION__, thread, id);
if (!thread->tproc->evfMap.close(id)) {
return ErrorCode::SRCH;
}
@ -175,6 +176,8 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id,
uint64_t patternSet, uint64_t mode,
ptr<uint64_t> pPatternSet,
ptr<uint> pTimeout) {
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, patternSet, mode, pPatternSet,
pTimeout);
if ((mode & (kEvfWaitModeAnd | kEvfWaitModeOr)) == 0 ||
(mode & ~(kEvfWaitModeAnd | kEvfWaitModeOr | kEvfWaitModeClearAll |
kEvfWaitModeClearPat)) != 0 ||
@ -194,6 +197,8 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id,
pPatternSet != nullptr ? &resultPattern : nullptr,
pTimeout != nullptr ? &resultTimeout : nullptr);
ORBIS_LOG_TRACE("sys_evf_wait wakeup", thread, resultPattern, resultTimeout);
if (pPatternSet != nullptr) {
uwrite(pPatternSet, (uint64_t)resultPattern);
}
@ -207,6 +212,7 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id,
orbis::SysResult orbis::sys_evf_trywait(Thread *thread, sint id,
uint64_t patternSet, uint64_t mode,
ptr<uint64_t> pPatternSet) {
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, patternSet, mode, pPatternSet);
if ((mode & (kEvfWaitModeAnd | kEvfWaitModeOr)) == 0 ||
(mode & ~(kEvfWaitModeAnd | kEvfWaitModeOr | kEvfWaitModeClearAll |
kEvfWaitModeClearPat)) != 0 ||
@ -231,6 +237,7 @@ orbis::SysResult orbis::sys_evf_trywait(Thread *thread, sint id,
return result;
}
orbis::SysResult orbis::sys_evf_set(Thread *thread, sint id, uint64_t value) {
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, value);
Ref<EventFlag> evf = thread->tproc->evfMap.get(id);
if (evf == nullptr) {
@ -241,6 +248,7 @@ orbis::SysResult orbis::sys_evf_set(Thread *thread, sint id, uint64_t value) {
return {};
}
orbis::SysResult orbis::sys_evf_clear(Thread *thread, sint id, uint64_t value) {
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, value);
Ref<EventFlag> evf = thread->tproc->evfMap.get(id);
if (evf == nullptr) {
@ -252,6 +260,7 @@ orbis::SysResult orbis::sys_evf_clear(Thread *thread, sint id, uint64_t value) {
}
orbis::SysResult orbis::sys_evf_cancel(Thread *thread, sint id, uint64_t value,
ptr<sint> pNumWaitThreads) {
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, value, pNumWaitThreads);
Ref<EventFlag> evf = thread->tproc->evfMap.get(id);
if (evf == nullptr) {