From 1cc95880eb5ad4c99d008c8d29f12d8d907d2d84 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 9 Jun 2003 20:48:14 +0000 Subject: [PATCH] On a real multicpu box the child thread could still be running when the parent thread was already testing. p4raw-id: //depot/perl@19731 --- ext/threads/shared/t/hv_refs.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"); -- 2.7.4