gamescope
gamescope copied to clipboard
Prevent SDL_WaitEvent loop from running before wlserver has finished initializing
(hopefully) fixes issue https://github.com/ValveSoftware/gamescope/issues/661
Uses ~~C++11 compatible~~ atomic ~~and condition~~ variable ~~(reusing the steamcompmgr "poor man's semaphore" class)~~ This PR only adds synchronization during startup, so not much overhead IMO
I had noticed that issue https://github.com/ValveSoftware/gamescope/issues/661 would be triggered 50% of the time when running ValveSoftware/gamescope/master under intel VTune. Compiling and running gamescope w/ this PR under intel VTune -> haven't seen any occurrences of the issue after running gamescope under VTune 4 different times.
You don't need to use the semaphore + condition variable, etc -- you can just use a std::atomic<bool>
+ .wait
+ .notify_all
on it.
You don't need to use the semaphore + condition variable, etc -- you can just use a
std::atomic<bool>
+.wait
+.notify_all
on it.
I was originally thinking of using atomic wait, but I realized that atomic wait is actually only in c++20 and up. Plus I don’t think gcc will compile with c++20 support by default (correct me if I am wrong on that). Wasn’t sure if you wanted gamescope to be able to be c++11 compatible or not.
Gamescope already requires C++20
Gamescope already requires C++20
Ah i see, ok I will revise this PR to use atomic
You don't need to use the semaphore + condition variable, etc -- you can just use a
std::atomic<bool>
+.wait
+.notify_all
on it.
Ok, I've now rewritten the PR to just use std::atomic<bool>
+ .wait
+ .notify_one
@Joshua-Ashton Could you please re-review this PR?
Superseded by commit https://github.com/ValveSoftware/gamescope/commit/be20af6e4f605dc159265a71b85d898643528c5e in upstream gamescope