Re: AW: Problem with thread
[email protected] (Aashish Chaudhary)
| Newsgroups | perl.ithreads |
|---|---|
| Message-ID | <[email protected]> |
Hi, Nope I dont have any references to $thread once its created. One thing when I was trying to do is my $thread = threads->new(........................)->detach; then this was giving me error: Free to wrong pool at ....Widget.pm at 96 during global destruction. but when I do this my $thread = threads->new(........................); $thread->detach; I dont get any error of above type and I can see that memory is not released. Whats the difference (Please consider me as a very new to Perl and Perl syntax) and what this error exactly means ? I am using Perl and for GUI perl/tk and I came to know that Perl/Tk is not thread safe. Thanks for your help. ~regards, aashish On Mon, 2 Aug 2004 21:22:07 -0600 (MDT), Thomas S Brettin <[email protected]> wrote: > > > for ($i=1;$i<255;$i++) > > > { > > > $host="10.10.10."."$i"; > > > my $thread = threads->create(threads,subping($host)); > > > } > > > > here I would say, you should write: > > my $thread1 = threads->new(\&subping, $host); > > > > So, what happens to the $thread variable in each iteration of the loop? > Does it go out of scope and get destroyed? Normally, if something else > references $thread, it does not get destroyed. But in this case, what > references $thread? I'm not sure. > > The code I've written code might look like this: > > for ($i=1;$i<255;$i++) { > $host="10.10.10."."$i"; > push @threads, threads->create(threads,subping($host)); > } > > Then somewhere else: > > foreach my $thread (@threads) { > $thread->join(); > } > > -- Aashish Chaudhary Research Assistant Iowa State University, Ames-IA Ph: 515-441-1178