develooper Front page | perl.perl5.porters | Postings from May 2003

perl 5.8.0 not concurrency safe

Thread Next
Gurusamy Sarathy
May 3, 2003 11:47
perl 5.8.0 not concurrency safe
Message ID:
It seems a bunch of globals that are neither constants nor
mutexes-that-protect-truly-global-state have snuck into perlvars.h.
This breaks concurrency safety pretty badly, so they need to get
moved into intrpvars.h.  If any of these variables need to point
to common memory, that needs to be done through a well-defined
protocol (i.e. a set of API functions that can be called on the
interpreter that needs its state changed).

Take the case of PL_threadhook, for instance.  If there are multiple
interpreters within the application (could be as simple as the
examples from perlembed.pod) and one of these interpreters does
a "use threads" which sets PL_threadhook, it affects all the other
interpreters that may be executing in different threads at a random
spot in their lifetime.  If the first interpreter is then destroyed,
it unloads, and now PL_threadhook is pointing at invalid
memory and at that point trying to destroy the other interpreters
will provoke a coredump.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About