use strict; use warnings; # hallelujah use threads; use threads::shared; # threads, oh how I hate my $lockvar : shared = 0; my $thrHandle = threads->create( &exampleSub ); {lock $lockvar; cond_wait ($lockvar);} # code that should be executed at the same time as the # block below $thrHandle->join(); sub exampleSub { # some initialisation which may, or may not, take a lot # of time {lock $lockvar; cond_signal( $lockvar );} # code that should be executed at the same time as the # block above }