Skip to content

Commit

Permalink
Add mutex over lowlatency update
Browse files Browse the repository at this point in the history
fixes a RDR freeze
  • Loading branch information
FakeMichau committed Nov 6, 2024
1 parent d7c1815 commit d8eed45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lowlatency.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class LowLatency {
#endif
lfx::LatencyFleX *lfx_ctx = nullptr;
std::mutex lfx_mutex;
std::mutex update_mutex;
unsigned long min_interval_us = 0;
bool al_available = false;
bool force_latencyflex = false;
Expand Down Expand Up @@ -121,7 +122,7 @@ class LowLatency {
AMD::AntiLag2DX12::Context al2_dx12_ctx = {};
AMD::AntiLag2DX11::Context al2_dx11_ctx = {};
#endif
CallSpot call_spot = CallSpot::SimulationStart;
CallSpot call_spot = CallSpot::SleepCall;
LFXStats lfx_stats = {};
LFXMode lfx_mode = {};
uint64_t calls_without_sleep = 0;
Expand Down Expand Up @@ -173,7 +174,10 @@ class LowLatency {
}

inline HRESULT update(uint64_t reflex_frame_id) {
std::lock_guard<std::mutex> lock(update_mutex);

update_config();

log_event("update", "{}", reflex_frame_id);
if (force_reflex == ForceReflex::ForceDisable || (force_reflex == ForceReflex::InGame && !active)) return S_FALSE;

Expand Down

0 comments on commit d8eed45

Please sign in to comment.