in reply to Thread very slow
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) { };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Thread very slow
by Dirk80 (Pilgrim) on Jul 12, 2010 at 13:22 UTC | |
by Corion (Patriarch) on Jul 12, 2010 at 13:26 UTC |