Skip to content

Commit

Permalink
fastgame_apply: monitoring the removal of the presets file and exitti…
Browse files Browse the repository at this point in the history
…ng accordingly
  • Loading branch information
wwmm committed Sep 18, 2024
1 parent 4334db6 commit 3c010a0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 0 additions & 14 deletions src/fastgame_apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,7 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int {

// nl->new_exit.connect([&](int pid) {});

auto check_lock_file = [&]() {
while (std::filesystem::is_regular_file(input_file)) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}

util::info("The lock file has been removed. Exitting the lock thread.");

nl->listen = false;
};

if (nl->listen) {
std::thread t(check_lock_file);

t.detach();

nl->handle_events(); // This is a blocking call. It has to be started at the end

util::info("Netlink event monitor finished.");
Expand Down
2 changes: 1 addition & 1 deletion src/netlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void Netlink::handle_events() {

auto* nlmsg_hdr = reinterpret_cast<nlmsghdr*>(buff.data());

while (NLMSG_OK(nlmsg_hdr, len) && listen) {
while (NLMSG_OK(nlmsg_hdr, len)) {
if (!std::filesystem::is_regular_file(input_file)) {
return;
}
Expand Down

0 comments on commit 3c010a0

Please sign in to comment.