... use threads (); use threads::shared (); use Thread::Semaphore; ... my $line_semi :shared = new Thread::Semaphore(0); #works in 5.8.8 ... ... sub sendout_sub ($ $) { ... { $line_semi->down(1); # line 309 lock @xlines; $line = shift @xlines; } #implicit unlock; ....