use threads;
use threads::shared;
-my @locks_down = (1) x 5;
+my @locks_down = (1) x 6;
my @locks_up = (0) x scalar @locks_down;
share($_) for @locks_down, @locks_up;
SKIP: {
my $thr1 = spawn(sub {
my $here = 'first simultaneous thread';
- is_loaded 0, "$here, beginning";
sync_slave 0;
+ is_loaded 0, "$here, beginning";
+ sync_slave 1;
+
do_load;
is_loaded 1, "$here, after loading";
- sync_slave 1;
sync_slave 2;
-
sync_slave 3;
- is_loaded 1, "$here, still loaded while also loaded in the other thread";
+
sync_slave 4;
+ is_loaded 1, "$here, still loaded while also loaded in the other thread";
+ sync_slave 5;
is_loaded 1, "$here, end";
my $thr2 = spawn(sub {
my $here = 'second simultaneous thread';
- is_loaded 0, "$here, beginning";
sync_slave 0;
+ is_loaded 0, "$here, beginning";
sync_slave 1;
- is_loaded 0, "$here, loaded in other thread but not here";
+
sync_slave 2;
+ sync_slave 3;
+ is_loaded 0, "$here, loaded in other thread but not here";
do_load;
is_loaded 1, "$here, after loading";
- sync_slave 3;
sync_slave 4;
+ sync_slave 5;
is_loaded 1, "$here, end";