$mw->{'start_b'} = $mw->Button('-relief' => 'raised', '-text' => 'START', '-command' => sub { evWorkStart(\%thread_data); });
I am surprised that you are not having thread crashes due to Tk's non-threadsafety. The code might work good if converted to Gtk2, which has better thread safety.
Back to your problem, I did something awhile back, that showed how to reuse threads with Tk... see Tk-with-worker-threads. Some of the improvements in perl thread signal handling, have since made my nested loops unnessary, thru thread signal handling. See using the thread->kill() feature on linux
But the main idea to make non-polluting code, is to recycle and reuse of course, so see Tk-with-worker-threads
Just beware, that Tk is NOT threadsafe, and unless you follow the many precautions, listed here, by various monks, you will have problems. See Re: Perl Tk and Threads
In reply to Re: Tk and Threads
by zentara
in thread Tk and Threads
by Dirk80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |