Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and I get#!/usr/local/bin/perl -w use Tk; use threads; use strict; my $mw = MainWindow->new(); my $text = $mw->Entry(-width =>8)->pack(); $text->insert(0,'abcde'); my $button = $mw->Button(-text=>'click', -command => \&test_thread)->p +ack(); MainLoop; sub test_thread{ my $long_thread = threads->create('long_running_sub'); $long_thread->detach(); } sub long_running_sub{ for my $i (0..2){ sleep 30; print $text->get() . "-$i\n"; } }
I want to use a new thread since otherwise the GUI become unresponsive whilst the sub runs (could be ~48 hours). Any other ways around this? Would fork/exec be an option?C:\work\BulkFirmwareUpgrade\v1>perl fd.pl Attempt to free non-existent shared string '_TK_RESULT_', Perl interpr +eter: 0x2c f271c at C:/Perl/site/lib/Tk.pm line 250. abcde-0 abcde-1 abcde-2 Attempt to free non-existent shared string '.entry', Perl interpreter: + 0x2cf271c at C:/Perl/site/lib/Tk/Widget.pm line 98 during global destruction. Free to wrong pool 2ceec98 not 225ba0 at C:/Perl/site/lib/Tk/Widget.pm + line 98 d uring global destruction.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Tk and Threads
by zentara (Cardinal) on Dec 23, 2008 at 16:35 UTC | |
| |
|
Re: Perl Tk and Threads
by liverpole (Monsignor) on Dec 23, 2008 at 16:31 UTC | |
|
Re: Perl Tk and Threads
by Anonymous Monk on Dec 23, 2008 at 15:33 UTC | |
|
Re: Perl Tk and Threads
by Anonymous Monk on Aug 21, 2012 at 11:30 UTC | |
by Anonymous Monk on Aug 21, 2012 at 15:10 UTC |