On Wed, Apr 06, 2005 at 11:02:49PM -0400, Stas Bekman wrote:
> It's time to write CLONE2 which should be a method, identical to DESTROY, 
> which should be called by perl_clone(), when it sees that the 
> object->can('CLONE2').

After some chatting with Stas, we've come to the conclusion that what he
needs most is the ability, on a per-class basis, to disable the cloning of
objects; ie in the child thread, each SvOBJECT() SV becomes an SVt_NULL
SV. This avoids all the problems of multiple calls to DESTROY, multiple
pointers to C structures etc.

The question then is how to flag a particular class (and its subclasses)
as being 'don't clone'.

The current suggestion is to have a class method called SHOULD_CLONE(),
and just before creating the new thread, this method is called, once per
stash, in the context of the parent thread. Any stash which has this
method and where it returns a false value, will be marked as 'don't clone'
for the duration of the cloning.

Better suggestions for the technique or the method name are welcome :-)

-- 
Spock (or Data) is fired from his high-ranking position for not being able
to understand the most basic nuances of about one in three sentences that
anyone says to him.
    -- Things That Never Happen in "Star Trek" #19

Reply via email to