adding application controll
This commit is contained in:
@@ -45,14 +45,14 @@ void process_changes(const FILE_NOTIFY_INFORMATION* pInfo) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
int thread_timeout = 0;
|
||||
while (get_num_threads()-1 >= std::thread::hardware_concurrency()) {
|
||||
Sleep(10);
|
||||
thread_timeout++;
|
||||
if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
|
||||
set_num_threads(0);
|
||||
}
|
||||
}
|
||||
//int thread_timeout = 0;
|
||||
//while (get_num_threads()-1 >= std::thread::hardware_concurrency()) {
|
||||
// Sleep(10);
|
||||
// thread_timeout++;
|
||||
// if (thread_timeout == 100 * 60) {//if there is for more than 30 seconds no thread available, chances are high, that the threads did not temrinate correctly but aren t running anymore. so set the counter to 0 because else it might just stop the scan.
|
||||
// set_num_threads(0);
|
||||
// }
|
||||
//}
|
||||
if (debug_mode())
|
||||
log(LOGLEVEL::INFO_NOSEND, "[process_changes()]: File ", filename_str.c_str(), " has been changed. Scanning it for viruses");
|
||||
std::thread scan_thread(scan_file_t, filename_str);
|
||||
@@ -137,7 +137,7 @@ void monitor_directory(LPCSTR directory) {
|
||||
buffer,
|
||||
bufferSize,
|
||||
TRUE,
|
||||
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_CREATION,
|
||||
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE,
|
||||
NULL,
|
||||
&overlapped,
|
||||
NULL) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user