On Sat, May 21, 2005 at 07:49:04PM +0100, Dave Mitchell wrote: > On Sat, May 21, 2005 at 04:25:10PM -0000, Nicholas Clark wrote: > > There is a bug in duping - GvHV() can end up pointing at garbage. > > > > I can reproduce it with: > > our $foo : unique = 'abc'; > use threads; > threads->create(sub { 1} )->join(); > > It seems to be down to the code in S_gv_share(), which at clone time > basically fills all unused slots (eg gv_hv) in the :unique GV with > &PL_sv_no from the *parent* thread:
Surely that logic is pants, in that: a: it should be PL_sv_no from the child thread and b: even PL_sv_no is wrong, because too much other code assumes that GVs point to the "correct" type. Can a parent thread go away before its child? What happens if a child thread creates a new unique GV, spawns a grandchild and then quits? Does this mess with the assumptions of the :unique implementation?i Nicholas Clark