in reply to Re: threads causing memory leak
in thread threads causing memory leak
Here you are:
holli
You can lead your users to water, but alas, you cannot drown them.
use strict; use threads; use warnings; use Win32::GUI qw(); use LWP::UserAgent; my $window = Win32::GUI::DialogBox->new( -title => "Test", -name => "T +est", -onTimer => sub { return poll() } ); my $use_up_some_memory = join( "", "x" x (1024 * 1024 * 20) ); $window->AddTimer( "T1", 20000 ); $window->Show; Win32::GUI::Dialog(); sub poll { my $rss : shared; print "polling\n"; my $thread = threads->create( sub { my $ua = LWP::UserAgent->new; my $response = $ua->get( 'http://www.mektek.net/mekmatch/listS +erversRss.mkz' ); $rss = $response->decoded_content if $response->is_success; } ); while ( $thread->is_running ) { sleep(1); Win32::GUI::DoEvents; } return unless $rss; }
holli
You can lead your users to water, but alas, you cannot drown them.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: threads causing memory leak
by BrowserUk (Patriarch) on Sep 11, 2010 at 14:44 UTC | |
Re^3: threads causing memory leak
by Corion (Patriarch) on Sep 11, 2010 at 13:40 UTC | |
by holli (Abbot) on Sep 11, 2010 at 13:45 UTC |
In Section
Seekers of Perl Wisdom