diff options
author | ferrreo <[email protected]> | 2023-07-24 17:26:24 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-07-24 18:26:24 +0200 |
commit | f6b340cc19d2b1fdca0ae2e72a18c87c63893507 (patch) | |
tree | c75306803240d30745cece07ce863b71eb80971d | |
parent | 76c6e09e3945ccf1d89ec4262a4ac3f7c3d3cca4 (diff) | |
download | Hyprland-f6b340cc19d2b1fdca0ae2e72a18c87c63893507.tar.gz Hyprland-f6b340cc19d2b1fdca0ae2e72a18c87c63893507.zip |
init: Fix for issue #2797 (#2799)
* Fix for issue #2797
* Fix for issue #2797
* Fix for issue #2797
-rw-r--r-- | src/init/initHelpers.cpp | 10 | ||||
-rw-r--r-- | src/main.cpp | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/init/initHelpers.cpp b/src/init/initHelpers.cpp index 2666ed0b..2a296d2e 100644 --- a/src/init/initHelpers.cpp +++ b/src/init/initHelpers.cpp @@ -6,7 +6,15 @@ bool Init::isSudo() { void Init::gainRealTime() { const int minPrio = sched_get_priority_min(SCHED_RR); - const struct sched_param param = {.sched_priority = minPrio}; + int old_policy; + struct sched_param param; + + if (pthread_getschedparam(pthread_self(), &old_policy, ¶m)) { + Debug::log(WARN, "Failed to get old pthread scheduling priority"); + return; + } + + param.sched_priority = minPrio; if (pthread_setschedparam(pthread_self(), SCHED_RR, ¶m)) { Debug::log(WARN, "Failed to change process scheduling strategy"); diff --git a/src/main.cpp b/src/main.cpp index 4d3d6474..fbd3da47 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,7 +89,6 @@ int main(int argc, char** argv) { } std::cout << "Welcome to Hyprland!\n"; - Init::gainRealTime(); // let's init the compositor. // it initializes basic Wayland stuff in the constructor. @@ -98,6 +97,8 @@ int main(int argc, char** argv) { g_pCompositor->initServer(); + Init::gainRealTime(); + Debug::log(LOG, "Hyprland init finished."); // If all's good to go, start. |