google for "perl threads copy on create"
...for Tk all 3 are correct....Tk goes out of it's way to bite you on the a*s when used with threads..... the real problem is that your experiments may work occaisionally, but then not when a different widget set involved, or different system speed or load..... etc etc etc... so you think you are figuring out a pattern.....then it turns out different on some other machine
... in Tk with threads, you need to keep all Tk code in the main thread of the parent process where the Tk mainloop runs....and you need to create the threads before any Tk code statements are made
...if you want to do what you are attempting..... create threads in gui button callbacks, or in some manner after the gui code has started.... use Gtk2....it is more advanced than Tk... see Gtk2 ....needs thread testing on a multi-threaded computer for how to do it, with the GLib::IdleAdd method, and the attempt at builtin object thread safety of Gtk2
.... i don't know about Storable's thread safety problems, but you can probably get around the problem the same way as Tk.... create your thread first thing in the code, and confine the storable code to a single thread
....another trick to try, is to create your object in the parent thread, and try to pass it as a reference into the thread creation command
.... sometimes that works, sometimes not$thread = threads->new(\&work , $object_ref);
In reply to Re: Perl Tk and threads
by zentara
in thread Perl Tk and threads
by nikosv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |