Skip to content

Commit

Permalink
Add interval configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
eschan145 committed Oct 28, 2024
1 parent e30d28a commit c4e5eca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Compile with g++ -shared -o api.dll api.cpp -Ofast -fPIC -shared
#include <string>
#include <thread>
#include <filesystem>
#include <fstream>
#include <windows.h>
#include <tlhelp32.h>

Expand Down Expand Up @@ -64,7 +65,22 @@ void monitor_executables(const string& folder_path)
close_application_by_exe(entry.path().filename().string());
}
}
this_thread::sleep_for(chrono::seconds(5)); // Polling interval

int interval;
std::ifstream interval_file("interval.txt");

if (interval_file.is_open())
{
interval_file >> interval;

if (interval_file.fail())
{
interval = 0
}

this_thread::sleep_for(chrono::seconds(inrerval));
interval_file.close();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions interval.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1

0 comments on commit c4e5eca

Please sign in to comment.