perl-diddler has asked for the wisdom of the Perl Monks concerning the following question:
I'm using a dynamically allocated queue, that I init with ||=, ala:
Since this is a 'test & set', and a typical location for a race condition, am I correct in assuming that this needs to be locked? during the test&set, like:$PageQueue ||= Queue->new;
Thanks!{ lock $PageQueue; $PageQueue ||= Queue->new; }
Back to
Seekers of Perl Wisdom