# 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"; $thread = threads->new(\<G::scanChange::monitor());# \<G::scanChange::monitor); $thread->detach(); # let go off the new thread #### sub monitor { my @wantedF; # folders to be scanned my @bannedF; # banned folders not to be scanned if ( -e LTG::dialog::CONFIGFILE) { open(FOLDERLIST,LTG::dialog::CONFIGFILE) or die "can't open file"; my $content = ; my $addForce = 0; while ($content) { if ($content ne "\n") { $content =~ s/\n/ /; ($content =~/^\#FORCE\#/)?($addForce = 1):(($content =~/^\#BAN\#/)?($addForce = 0):($addForce?push(@wantedF,$content):push(@bannedF,$content))); } $content = ; } close (FOLDERLIST); } open (THREADCOM, ">".LTG::dialog::THREADCOM) or die "Can't create/overwrite file: $!\n"; print THREADCOM "1"; close THREADCOM; my $active = 1; while ($active) { if ( -e LTG::dialog::THREADCOM) { open(THREADCOM,LTG::dialog::THREADCOM) or die "can't open file THREADCOM"; $active = ; print "active : $active \n"; close THREADCOM; } my %changes = LTG::scanChange::startScan(\@wantedF,\@bannedF,INC_SUBDIRS); foreach my $k (keys %changes) { print "key : $k -> content : $changes{$k}\n"; } # update database here Sumith # print "---while---\n"; } } #### This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 635 provided by ActiveState Corp. http://www.ActiveState.com Built 15:34:21 Feb 4 2003 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page.