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.
In reply to Perl Tk and Threads by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |