From: Vincent Pit Date: Mon, 6 Apr 2015 16:30:10 +0000 (-0300) Subject: Make sure the module is loaded in the first thread first X-Git-Tag: v0.35~9 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=4838c6541e1f54c7c8b12def045ee6517c1199c9 Make sure the module is loaded in the first thread first --- diff --git a/t/09-load-threads.t b/t/09-load-threads.t index 7575b2d..4652ab9 100644 --- a/t/09-load-threads.t +++ b/t/09-load-threads.t @@ -182,7 +182,7 @@ is_loaded 0, 'main body, after nested loadings'; 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; @@ -221,17 +221,19 @@ sub sync_slave { 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"; @@ -242,17 +244,19 @@ SKIP: { 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";