> > There has to be some way to use modules that are not yet updated to
> > use the callback.
>
> How? By imposing mutexes around the xsubs?
Well if the module is this unsafe we probably cannot do anything
automatic. A note that the module in question is surely unsafe
somewhere is the best we can get I'm afraid :-(
This "undef on clone" could help only with modules that are safe
as long as no object is shared between several threads.
If the module doesn't have any global data (or protects it properly)
and doesn't use any thread-unsafe functions then even if the
per-object-instance data are not protected as long as you do not
share instances you should be safe.
> This will break the normal behaviour people expect from fork(), this problem
> is a problem incommon with fork() on external objects in the unix world
> (fork with DBI for example can be very bad).
You mean "uncommon" ?
I have to admit I have no experience with fork() in the Unix world at
all :-( And I don't have any Unix handy to try it.
What does it do if you fork with DBI?
Here under Win2k+iThreads it crashes even if I use the
handle only in parent thread. I guess some properties are objects as
well.
> I am not sure fixing an
> autosemantic for this without fixing it in the fork world would be a good
> thing. If you speak about a fix for people using ithreads. How should we do
> it? Undef every object that has not declared itself to be safe? The user
> must explicitly tell us what objects to null, and then that nulling could be
> implmented by a wrapper object or class that listens for the CLONE callback.
You are right. If someone knows what is he doing (or he thinks he
does ;-) he will do the necessary dirty tricks. Others should wait
till the module is updated.
Sorry to bother.
> And what should that default CLONEr be? We cannot clone the C struct behind
> it :).
>
> Artur
Sure. That could only be something that would actualy not clone the
object. I have to admit I don't know how's that cloning implemented
or what would be possible.
Thanks for the info. Jenda