sub B_resetScan_Click # saves text file, stops thread, restarts thread. { # open file for write - we want to overwrite the previous file with the new one open(FOLDERLIST, ">".LTG::dialog::CONFIGFILE) or die "Can't create/overwrite file: $!\n"; print FOLDERLIST "#FORCE#\n"; # category ID foreach (0..$window->LB_forceFolder->Count()) { # add each element of the force folder after replacing backslashes by forward slashes my $folder = $window->LB_forceFolder->GetString($_); while ($folder =~ /\\/){ $folder =~ s/\\/\//; } print FOLDERLIST $folder."\n"; } print FOLDERLIST "#BAN#\n"; # category ID foreach (0..$window->LB_banFolder->Count()) { # add each element of the ban folder my $folder = $window->LB_banFolder->GetString($_); while ($folder =~ /\\/){ $folder =~ s/\\/\//; } print FOLDERLIST $folder."\n"; } close (FOLDERLIST); # now stop the current scan thread # to do this, write in a file th_com.thd the value 0 #if (defined $thread) #{ # open (THREADCOM, ">".LTG::dialog::THREADCOM) or die "Can't create/overwrite file: $!\n"; # print (THREADCOM,"0"); # close THREADCOM; # stop thread #} print "create thread\n"; my $run : shared = 1; $thread = threads->new(\<G::scanChange::monitor());# \<G::scanChange::monitor); print "Waiting 5 seconds while the thread runs\n"; sleep 5; print "Shutting down\n"; $run = 0; $thread->join; }