From: Jarkko Hietaniemi Date: Mon, 9 Jun 2003 20:48:14 +0000 (+0000) Subject: On a real multicpu box the child thread could still be running X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1cc95880eb5ad4c99d008c8d29f12d8d907d2d84;p=p5sagit%2Fp5-mst-13.2.git On a real multicpu box the child thread could still be running when the parent thread was already testing. p4raw-id: //depot/perl@19731 --- diff --git a/ext/threads/shared/t/hv_refs.t b/ext/threads/shared/t/hv_refs.t index 66df0a6..5ef0c05 100644 --- a/ext/threads/shared/t/hv_refs.t +++ b/ext/threads/shared/t/hv_refs.t @@ -86,7 +86,13 @@ ok(10, keys %foo == 0, "And make sure we realy have deleted the values"); } { my $object : shared = &share({}); - threads->new(sub { bless $object, 'test1' }); + lock($object); # so that we can cond_wait + threads->new(sub { + lock($object); # so that we can cond_signal + bless $object, 'test1'; + cond_signal($object); # so that the parent thread waits + }); + cond_wait($object); # so that the child thread finishes ok(15, ref($object) eq 'test1', "blessing does work"); my %test = (object => $object); ok(16, ref($test{object}) eq 'test1', "and some more work");