diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-09 20:48:14 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-09 20:48:14 +0000 |
commit | 1cc95880eb5ad4c99d008c8d29f12d8d907d2d84 (patch) | |
tree | de28af93404d007e3ba6cfcb60c66d35f4670e9a | |
parent | 4f76e5bab63673fb9ea7a2cb98436b4276eaa849 (diff) | |
download | perl-1cc95880eb5ad4c99d008c8d29f12d8d907d2d84.tar.gz |
On a real multicpu box the child thread could still be running
when the parent thread was already testing.
p4raw-id: //depot/perl@19731
-rw-r--r-- | ext/threads/shared/t/hv_refs.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/threads/shared/t/hv_refs.t b/ext/threads/shared/t/hv_refs.t index 66df0a6278..5ef0c05ca1 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"); |