From a7d255d401c8d79bd490e83c91e2c00e8556963e Mon Sep 17 00:00:00 2001 From: Ivan Chikish Date: Sun, 23 Jul 2023 04:50:11 +0300 Subject: [PATCH] [orbis-kernel] Fixup evf waiting --- orbis-kernel/src/evf.cpp | 6 ++---- orbis-kernel/src/sys/sys_sce.cpp | 16 +++++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/orbis-kernel/src/evf.cpp b/orbis-kernel/src/evf.cpp index dd3e2fe68..063362f41 100644 --- a/orbis-kernel/src/evf.cpp +++ b/orbis-kernel/src/evf.cpp @@ -131,11 +131,9 @@ std::size_t orbis::EventFlag::notify(NotifyType type, std::uint64_t bits) { } auto resultValue = thread->applyClear(patValue); + thread->thread->evfResultPattern = patValue; + thread->thread->evfIsCancelled = type == NotifyType::Cancel; patValue = resultValue; - thread->thread->evfResultPattern = resultValue; - if (type == NotifyType::Cancel) { - thread->thread->evfIsCancelled = 1; - } // TODO: update thread state // release wait on waiter thread diff --git a/orbis-kernel/src/sys/sys_sce.cpp b/orbis-kernel/src/sys/sys_sce.cpp index 753e8b1f5..e07b844e5 100644 --- a/orbis-kernel/src/sys/sys_sce.cpp +++ b/orbis-kernel/src/sys/sys_sce.cpp @@ -180,7 +180,7 @@ orbis::SysResult orbis::sys_evf_open(Thread *thread, ptr name) { return {}; } orbis::SysResult orbis::sys_evf_close(Thread *thread, sint id) { - ORBIS_LOG_WARNING(__FUNCTION__, thread, id); + ORBIS_LOG_WARNING(__FUNCTION__, thread->tid, id); if (!thread->tproc->evfMap.close(id)) { return ErrorCode::SRCH; } @@ -191,7 +191,7 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id, uint64_t patternSet, uint64_t mode, ptr pPatternSet, ptr pTimeout) { - ORBIS_LOG_NOTICE(__FUNCTION__, thread, id, patternSet, mode, pPatternSet, + ORBIS_LOG_NOTICE(__FUNCTION__, thread->tid, id, patternSet, mode, pPatternSet, pTimeout); if ((mode & (kEvfWaitModeAnd | kEvfWaitModeOr)) == 0 || (mode & ~(kEvfWaitModeAnd | kEvfWaitModeOr | kEvfWaitModeClearAll | @@ -210,7 +210,8 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id, auto result = evf->wait(thread, mode, patternSet, pTimeout != nullptr ? &resultTimeout : nullptr); - ORBIS_LOG_NOTICE("sys_evf_wait wakeup", thread, thread->evfResultPattern); + ORBIS_LOG_NOTICE("sys_evf_wait wakeup", thread->tid, + thread->evfResultPattern); if (pPatternSet != nullptr) { uwrite(pPatternSet, thread->evfResultPattern); @@ -226,7 +227,8 @@ 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 pPatternSet) { - ORBIS_LOG_NOTICE(__FUNCTION__, thread, id, patternSet, mode, pPatternSet); + ORBIS_LOG_NOTICE(__FUNCTION__, thread->tid, id, patternSet, mode, + pPatternSet); if ((mode & (kEvfWaitModeAnd | kEvfWaitModeOr)) == 0 || (mode & ~(kEvfWaitModeAnd | kEvfWaitModeOr | kEvfWaitModeClearAll | kEvfWaitModeClearPat)) != 0 || @@ -249,7 +251,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_NOTICE(__FUNCTION__, thread, id, value); + ORBIS_LOG_NOTICE(__FUNCTION__, thread->tid, id, value); Ref evf = thread->tproc->evfMap.get(id); if (evf == nullptr) { @@ -260,7 +262,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_NOTICE(__FUNCTION__, thread, id, value); + ORBIS_LOG_NOTICE(__FUNCTION__, thread->tid, id, value); Ref evf = thread->tproc->evfMap.get(id); if (evf == nullptr) { @@ -272,7 +274,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 pNumWaitThreads) { - ORBIS_LOG_NOTICE(__FUNCTION__, thread, id, value, pNumWaitThreads); + ORBIS_LOG_NOTICE(__FUNCTION__, thread->tid, id, value, pNumWaitThreads); Ref evf = thread->tproc->evfMap.get(id); if (evf == nullptr) {