sub task { our $mutex; $mutex->lock; # not necessary when accessing shared-objects via the OO interface $result->push(shift); $mutex->unlock; $mutex->lock; # necessary if dereferencing involves fetch and store behind TIE push @{ $result }, shift; $mutex->unlock; }