fast has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, It is bad to open the pipe line without close?. In theory it is, however does it cause any harm in my case?
use Tk; my $stop :shared=0; #...create Tk window $parent-> Button(-text=>"stop", -command=>sub{$stop=1;}); $parent-> Button(-text=>"run", -command=>\&run_thread); sub run_thread { async{ &process; }; } sub process { open(CTFIND, "sometool find $path -print |"); while(<CTFIND>) { if($stop eq 1) { #close command take a while #close CTFIND; This command will take a while to #close. It is cause any problem without close #pipe line? print"End Task\n"; return; } chomp; #..... some date process } close CTFIND; return; }
I want to stop the thread right away when user hit the stop button. If I include the close CTFINE then it will a while to close.
Thanks all for reading
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open pipe without close
by cdarke (Prior) on Feb 26, 2010 at 09:37 UTC | |
by fast (Novice) on Feb 26, 2010 at 23:34 UTC | |
by cdarke (Prior) on Feb 27, 2010 at 14:49 UTC |