Maybe tied the variables in your Tk GUI, so they automatically update whenever they get changed from the GUI? And it seems that passing these variables into the thread queue did not dissociate them, which seems weird to me.
Personally, I would only pass values through queues, that is, copy the values out. Also, I wouldn't pass multiple different values to the thread but pass in all values for one job in one go:
use Data::Dumper; my $job = {}; for my $field (qw( lri pm gp )) { $job->{ $field } = { %$gen_data{ $field } }; warn "Processing " . Dumper $job; sleep 10; }; warn "Enqueuing " . Dumper $job; $q->enqueue( $job ); $q->enqueue( undef ); # tell the thread that we're done and it should +quit ... # In the thread while (my $job = $q->dequeue) { };
In reply to Re: Thread very slow
by Corion
in thread Thread very slow
by Dirk80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |