Skip to content

Commit

Permalink
kernel: kevent: wake up on signals
Browse files Browse the repository at this point in the history
fix freeze in compositor
  • Loading branch information
DHrpcs3 committed Nov 24, 2024
1 parent 9bed100 commit e0650ef
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions orbis-kernel/src/sys/sys_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ orbis::SysResult orbis::sys_kevent(Thread *thread, sint fd,
if (note.enabled && note.triggered) {
result.push_back(note.event);

if (note.event.filter == kEvFiltDisplay) {
if (note.event.filter == kEvFiltDisplay &&
note.event.ident >> 48 != 0x6301) {
note.triggered = false;
}

Expand Down Expand Up @@ -365,11 +366,17 @@ orbis::SysResult orbis::sys_kevent(Thread *thread, sint fd,
auto waitTimeout = std::chrono::duration_cast<std::chrono::microseconds>(
timeoutPoint - now);
if (canSleep) {
kq->cv.wait(kq->mtx, waitTimeout.count());
if (waitTimeout.count() > 1000) {
orbis::scoped_unblock unblock;
kq->cv.wait(kq->mtx, waitTimeout.count());
} else {
kq->cv.wait(kq->mtx, waitTimeout.count());
}
}
} else {
if (canSleep) {
std::lock_guard lock(kq->mtx);
orbis::scoped_unblock unblock;
kq->cv.wait(kq->mtx);
} else {
std::this_thread::sleep_for(std::chrono::microseconds(30));
Expand Down

0 comments on commit e0650ef

Please sign in to comment.