I wanted to start off with ithreads by implementing a clock with the tk
lib,
the bad case is that it doesn't seem to support the ithreads :(.
Anyway this is what i do , i create a new Window and try to alter it's
title in another thread :
# ==> program starts here
use strict;
use Tk;
use threads;
use threads::shared;
# for debugging
$|=1;
# constructing a new window
my $mw = new MainWindow('title'=>"Tiitel");
#starting the other thread
# which should change our title
print "calling thread to alter title \n";
threads->create("alter_title",$mw);
# this loops the tk events and refreshes the window inner things like
buttons etc.
# it blocks until the window is closed
MainLoop;
sub alter_title {
print "altering title \n";
my $win = pop @_;
$win->configure('title'=>'another title');
}
# ==> program endz here
i get an error like this :
"Free to wrong pool 15d3f78 not 1da0280 at C:/Perl/site/lib/Tk.pm line
340."
i assume that another thread is getting a bit messed up with the allocated
mem it self
hasn't allocated ?
anyway, is there any hope to get this working ?
i need an external thread to update the main window from time to time.
but it seems a bit hard to do when i can't access the window that has been
created :(
maybe some kind of a back hand reference thingy could/may work ?
i already played around with some references and stuff but didn't work that
easily :(
Martin [ps. if the code seems a bit odd, don't mind, i haven't programmed
in perl for 3 years ... so much is lost]