use strict; use warnings; use threads; use threads::shared; use Thread::Queue; my $queue = Thread::Queue->new; my %urls = (); share(%urls); my $url = 'http://www.perlmonks.org/'; my $visited = do { lock(%urls); $urls{$url}++ }; if (!$visited) { $queue->enqueue($url); }
Update: added locking
In reply to Re: Thread::Queue Internals/Duplicates
by martin
in thread Bandwidth Usage?
by ramblinpeck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |