1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

WindowServer: Give a thread boost to the currently active window

When the currently active (foreground) window is owned by a client,
we now apply a +10 priority boost to the client's main thread.

You normally want the window you're interacting with to be responsive,
so this little boost allows it to run a bit sooner and more often. :^)
This commit is contained in:
Andreas Kling 2019-12-30 19:27:58 +01:00
parent 610f3ad12f
commit 0dea0fd06f
3 changed files with 29 additions and 3 deletions

View file

@ -15,10 +15,8 @@
#include <WindowServer/WSWindowSwitcher.h>
#include <WindowServer/WindowClientEndpoint.h>
#include <errno.h>
#include <serenity.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <unistd.h>
HashMap<int, NonnullRefPtr<WSClientConnection>>* s_connections;
@ -654,3 +652,15 @@ OwnPtr<WindowServer::StartDragResponse> WSClientConnection::handle(const WindowS
wm.start_dnd_drag(*this, message.text(), bitmap, message.data_type(), message.data());
return make<WindowServer::StartDragResponse>(true);
}
void WSClientConnection::boost()
{
if (set_thread_boost(client_pid(), 10) < 0)
perror("boost: set_thread_boost");
}
void WSClientConnection::deboost()
{
if (set_thread_boost(client_pid(), 0) < 0)
perror("deboost: set_thread_boost");
}