mirror of
https://github.com/flightlessmango/MangoHud.git
synced 2024-11-04 06:00:23 +00:00
[config] Load config changes to local copy of overlay_params so it does not block rendering thread while parsing
This commit is contained in:
parent
0d53d7d39d
commit
49742e1cea
@ -13,6 +13,7 @@ static void *fileChanged(void *params_void) {
|
||||
notify_thread *nt = reinterpret_cast<notify_thread *>(params_void);
|
||||
int length, i = 0;
|
||||
char buffer[EVENT_BUF_LEN];
|
||||
overlay_params local_params = *nt->params;
|
||||
|
||||
while (!nt->quit) {
|
||||
length = read( nt->fd, buffer, EVENT_BUF_LEN );
|
||||
@ -21,14 +22,14 @@ static void *fileChanged(void *params_void) {
|
||||
(struct inotify_event *) &buffer[i];
|
||||
i += EVENT_SIZE + event->len;
|
||||
if (event->mask & IN_MODIFY) {
|
||||
parse_overlay_config(&local_params, getenv("MANGOHUD_CONFIG"));
|
||||
std::lock_guard<std::mutex> lk(nt->mutex);
|
||||
parse_overlay_config(nt->params, getenv("MANGOHUD_CONFIG"));
|
||||
*nt->params = local_params;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
printf("%s quit\n", __func__);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user