]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Make sure the module is loaded in the first thread first
authorVincent Pit <vince@profvince.com>
Mon, 6 Apr 2015 16:30:10 +0000 (13:30 -0300)
committerVincent Pit <vince@profvince.com>
Mon, 6 Apr 2015 16:30:10 +0000 (13:30 -0300)
t/09-load-threads.t

index 7575b2dcec583f2304a079ee7fdb473517d9eb10..4652ab9f7d489da70bf7fe3381176df6a0be7904 100644 (file)
@@ -182,7 +182,7 @@ is_loaded 0, 'main body, after nested loadings';
 use threads;
 use threads::shared;
 
 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;
 
 my @locks_up   = (0) x scalar @locks_down;
 share($_) for @locks_down, @locks_up;
 
@@ -221,17 +221,19 @@ sub sync_slave {
 SKIP: {
  my $thr1 = spawn(sub {
   my $here = 'first simultaneous thread';
 SKIP: {
  my $thr1 = spawn(sub {
   my $here = 'first simultaneous thread';
-  is_loaded 0, "$here, beginning";
   sync_slave 0;
 
   sync_slave 0;
 
+  is_loaded 0, "$here, beginning";
+  sync_slave 1;
+
   do_load;
   is_loaded 1, "$here, after loading";
   do_load;
   is_loaded 1, "$here, after loading";
-  sync_slave 1;
   sync_slave 2;
   sync_slave 2;
-
   sync_slave 3;
   sync_slave 3;
-  is_loaded 1, "$here, still loaded while also loaded in the other thread";
+
   sync_slave 4;
   sync_slave 4;
+  is_loaded 1, "$here, still loaded while also loaded in the other thread";
+  sync_slave 5;
 
   is_loaded 1, "$here, end";
 
 
   is_loaded 1, "$here, end";
 
@@ -242,17 +244,19 @@ SKIP: {
 
  my $thr2 = spawn(sub {
   my $here = 'second simultaneous thread';
 
  my $thr2 = spawn(sub {
   my $here = 'second simultaneous thread';
-  is_loaded 0, "$here, beginning";
   sync_slave 0;
 
   sync_slave 0;
 
+  is_loaded 0, "$here, beginning";
   sync_slave 1;
   sync_slave 1;
-  is_loaded 0, "$here, loaded in other thread but not here";
+
   sync_slave 2;
   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";
 
   do_load;
   is_loaded 1, "$here, after loading";
-  sync_slave 3;
   sync_slave 4;
   sync_slave 4;
+  sync_slave 5;
 
   is_loaded 1, "$here, end";
 
 
   is_loaded 1, "$here, end";